aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-12-16 23:31:06 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-12-16 23:31:06 -0500
commitf07c07e551b89b66b14936ae4573e656fbd7afb6 (patch)
tree3c9acb1228c7e74ce671661bf9c15616e0cfc7f7 /src/stdlib
parentc5878cced02fd1ed7e7940eaf8eb8b4cce23a9d4 (diff)
Fix parens parsing and hook up sqrt
Diffstat (limited to 'src/stdlib')
-rw-r--r--src/stdlib/reals.c2
-rw-r--r--src/stdlib/reals.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/stdlib/reals.c b/src/stdlib/reals.c
index 40f4cf4c..aee39414 100644
--- a/src/stdlib/reals.c
+++ b/src/stdlib/reals.c
@@ -240,7 +240,7 @@ Real_t Real$divided_by(Real_t x, Real_t y) {
}
static Int_t Real$compute_sqrt(Real_t r, int64_t decimals) {
- Real_t operand = &r->userdata.children[0];
+ Real_t operand = r->userdata.children;
double d = Real$as_float64(operand);
// TODO: newton's method to iterate
return Int$from_float64(sqrt(d) * pow(10.0, (double)decimals), true);
diff --git a/src/stdlib/reals.h b/src/stdlib/reals.h
index 1d304aa5..8750fdbb 100644
--- a/src/stdlib/reals.h
+++ b/src/stdlib/reals.h
@@ -18,7 +18,7 @@ double Real$as_float64(Real_t x);
Int_t Real$as_int(Real_t x);
Real_t Real$negative(Real_t x);
-// Real_t Real$inverse(Real_t x);
+Real_t Real$sqrt(Real_t x);
Real_t Real$plus(Real_t x, Real_t y);
Real_t Real$minus(Real_t x, Real_t y);
Real_t Real$times(Real_t x, Real_t y);