From f07c07e551b89b66b14936ae4573e656fbd7afb6 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 16 Dec 2025 23:31:06 -0500 Subject: Fix parens parsing and hook up sqrt --- src/stdlib/reals.c | 2 +- src/stdlib/reals.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/stdlib') 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); -- cgit v1.2.3