aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2026-01-16 20:33:43 -0500
committerBruce Hill <bruce@bruce-hill.com>2026-01-16 20:33:43 -0500
commita274f836acb34d24ff447c715710c59fde570830 (patch)
tree9e8a4f356e04d5ae9632d231d636ed711a5241dd
parentc64fa0d256ffdba8052580001a34da13157672fd (diff)
Remove constructives
-rw-r--r--src/compile/expressions.c3
-rw-r--r--src/stdlib/datatypes.h10
-rw-r--r--src/stdlib/reals.c11
3 files changed, 1 insertions, 23 deletions
diff --git a/src/compile/expressions.c b/src/compile/expressions.c
index 05ea938f..8f228ca3 100644
--- a/src/compile/expressions.c
+++ b/src/compile/expressions.c
@@ -145,9 +145,6 @@ Text_t compile_real(ast_t *ast, Real_t num) {
return Texts("Real$divided_by(", compile_real(ast, num_real), ", ", compile_real(ast, den_real), ")");
}
}
- case REAL_TAG_CONSTRUCTIVE: {
- code_err(ast, "Constructive reals can't be compiled yet");
- }
case REAL_TAG_SYMBOLIC: {
symbolic_t *s = REAL_SYMBOLIC(num);
diff --git a/src/stdlib/datatypes.h b/src/stdlib/datatypes.h
index e8848e9a..8748e2be 100644
--- a/src/stdlib/datatypes.h
+++ b/src/stdlib/datatypes.h
@@ -46,8 +46,7 @@ typedef union {
#define REAL_TAG_NONE 0ULL
#define REAL_TAG_BIGINT 1ULL
#define REAL_TAG_RATIONAL 2ULL
-#define REAL_TAG_CONSTRUCTIVE 3ULL
-#define REAL_TAG_SYMBOLIC 4ULL
+#define REAL_TAG_SYMBOLIC 3ULL
#define REAL_DOUBLE(r) \
(((union { \
@@ -57,18 +56,12 @@ typedef union {
.d)
#define REAL_BIGINT(r) ((Int_t *)((r).bits & ~0x7ULL))
#define REAL_RATIONAL(r) ((rational_t *)((r).bits & ~0x7ULL))
-#define REAL_CONSTRUCTIVE(r) ((constructive_t *)((r).bits & ~0x7ULL))
#define REAL_SYMBOLIC(r) ((symbolic_t *)((r).bits & ~0x7ULL))
typedef struct {
__mpq_struct value;
} rational_t;
-typedef struct {
- double (*compute)(void *ctx, int precision);
- void *context;
-} constructive_t;
-
typedef enum {
SYM_INVALID,
SYM_ADD,
@@ -100,7 +93,6 @@ typedef union {
uint64_t bits;
struct symbolic *symbolic;
rational_t *rational;
- constructive_t *constructive;
Int_t *bigint;
} Real_t;
diff --git a/src/stdlib/reals.c b/src/stdlib/reals.c
index 27630c3d..bbe19d0d 100644
--- a/src/stdlib/reals.c
+++ b/src/stdlib/reals.c
@@ -131,10 +131,6 @@ double Real$as_float64(Real_t n, bool truncate) {
rational_t *rational = REAL_RATIONAL(n);
return mpq_get_d(&rational->value);
}
- case REAL_TAG_CONSTRUCTIVE: {
- constructive_t *c = REAL_CONSTRUCTIVE(n);
- return c->compute(c->context, 53);
- }
case REAL_TAG_SYMBOLIC: {
symbolic_t *s = REAL_SYMBOLIC(n);
double left = Real$as_float64(s->left, truncate);
@@ -607,13 +603,6 @@ Text_t Real$as_text(const void *n, bool colorize, const TypeInfo_t *type) {
: Texts(num_str, "/", den_str);
return result;
}
- case REAL_TAG_CONSTRUCTIVE: {
- constructive_t *c = REAL_CONSTRUCTIVE(num);
- double approx = c->compute(c->context, 53);
- char buf[64];
- snprintf(buf, sizeof(buf), "~%.17g", approx);
- return colorize ? Texts(operator_color, "~", number_color, buf + 1, reset) : Text$from_str(buf);
- }
case REAL_TAG_SYMBOLIC: {
symbolic_t *s = REAL_SYMBOLIC(num);
const char *func = NULL;