From a4eb2d1ad35f2ee2da2aa442b19d2e8267e71afa Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 11 Jan 2026 14:58:28 -0500 Subject: Hook up Real.rounded_to() --- src/environment.c | 1 + src/stdlib/reals.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/environment.c b/src/environment.c index baae3beb..8087820a 100644 --- a/src/environment.c +++ b/src/environment.c @@ -300,6 +300,7 @@ env_t *global_env(bool source_mapping) { {"power", "Real$power", "func(base:Real,exponent:Real -> Real)"}, // {"sqrt", "Real$sqrt", "func(x:Real -> Real)"}, // {"times", "Real$times", "func(x,y:Real -> Real)"}, // + {"rounded_to", "Real$rounded_to", "func(x:Real, rounded_to:Real = 1.0 -> Real)"}, // ), MAKE_TYPE( // "CString", Type(CStringType), Text("char*"), Text("CString$info"), // diff --git a/src/stdlib/reals.h b/src/stdlib/reals.h index a322ff64..ddb91f66 100644 --- a/src/stdlib/reals.h +++ b/src/stdlib/reals.h @@ -39,6 +39,8 @@ Real_t Real$sqrt(Real_t x); bool Real$equal(const void *va, const void *vb, const TypeInfo_t *t); int32_t Real$compare(const void *va, const void *vb, const TypeInfo_t *t); +Real_t Real$rounded_to(Real_t x, Real_t round_to); + int Real$test(); extern const TypeInfo_t Real$info; -- cgit v1.2.3