From 6f8b658c17a016b65aa4f3e392f0f6e27063fc02 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Mon, 25 May 2026 13:29:35 +0900 Subject: [PATCH] lib/math: inline floats f64bits/f64frombits reinterpret deref Mirror Hare's single-expression `*(&n: *T)` structure (CLAUDE.md rule 12) instead of a let-temp two-step that added a binding Hare has no counterpart for. Document the load-bearing parens (rule 8): ww's `:` cast binds tighter than unary `&`, so the bare Hare form parses as `*(&(n: *T))`; `(&n): *T` is what reinterprets the address. ref/hare/math/floats.ha:5,11. Byte-identical both stages; 952 6/6. --- lib/math/floats.ww | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/math/floats.ww b/lib/math/floats.ww index d6bd2367..cb9ce8ff 100644 --- a/lib/math/floats.ww +++ b/lib/math/floats.ww @@ -6,17 +6,17 @@ package math; // Returns the binary representation of the given f64. -// ref/hare/math/floats.ha:5 +// ref/hare/math/floats.ha:5. Parens around &n are load-bearing: ww's `:` +// cast binds tighter than unary `&`, so Hare's `*(&n: *u64)` would parse +// as `*(&(n: *u64))`; `(&n): *u64` reinterprets the address as intended. export fn f64bits(n: f64) u64 = { - let p: *u64 = (&n): *u64; - return *p; + return *((&n): *u64); }; // Returns f64 with the given binary representation. // ref/hare/math/floats.ha:11 export fn f64frombits(n: u64) f64 = { - let p: *f64 = (&n): *f64; - return *p; + return *((&n): *f64); }; // ref/hare/math/floats.ha:17,20,23 declare these as untyped int. ww has