From fc51e9a4080f808188c37c01d96353ea5080e6be Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 23 Sep 2026 05:06:10 +0200 Subject: [PATCH] R-AI: pin render_f64's sign-bit extraction on a negative value too Same gap as render_f32's sign-bit test (previous commit): render_f64's sign extraction has the identical shape and the identical coincidence (-1.0_f64/-2.0_f64's bit 0 happens to be 0, matching their real sign bit's positive-looking value under a wrong-direction shift). Co-Authored-By: Claude Sonnet 5 --- packages/cultnet-rs/src/selection.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/cultnet-rs/src/selection.rs b/packages/cultnet-rs/src/selection.rs index 3df42a7b..62323c0b 100644 --- a/packages/cultnet-rs/src/selection.rs +++ b/packages/cultnet-rs/src/selection.rs @@ -482,6 +482,14 @@ pub mod canonical_number { assert_eq!(super::render_f32(-2.0_f32).unwrap(), "-2"); } + // R-AI: render_f64's sign extraction has the identical shape (`(bits >> 63) & 1 == 1`) and + // the identical gap - -1.0_f64 and -2.0_f64's bit 0 is 0, same coincidence as f32's. + #[test] + fn render_f64_negative_values_carry_the_sign() { + assert_eq!(super::render_f64(-1.0_f64).unwrap(), "-1"); + assert_eq!(super::render_f64(-2.0_f64).unwrap(), "-2"); + } + // R-AI/R-D: `is_canonical` is the Q-J door's grammar // (`^-?(0|[1-9][0-9]*)(\.[0-9]*[1-9])?$`, minus the literal "-0") and was, until this test, // never called directly by any test in this crate - only reachable through