fold-2 chunk C4 (drew's Fam8-13 plan): 13 float value-row C drivers re-homed. 11 migrate to test/lang/*_test.ww @test row-tables (exact IEEE-bit asserts); 1 float-overflow reject row -> a runww //ww:error carrier. 956_tuprecv_f64 slims to a w6c_ww asserttyped pin (20 value rows -> @test; the stamp dimension can't be a value/byte-id @test) -- mutation-proven non-vacuous (break #121 stamp -> RED 6/6 -> restore -> GREEN) + an in-test vacuity self-check. 946_structparam/structret stay whole: their SSE register-class .s-grep (SysV ABI conformance, #165/#171a) is the genuine defect-guard, not @test-expressible. Float was the predicted SSE-cursor byte-id hotspot -- zero fresh cs!=ww surfaced; 951_f64cgen (cstage-only before) byte-ids clean. LANGBYTEID floor 82->93; test count 384->374 (10 deleted drivers; 956 + the 2 946 kept).
46 lines
2.3 KiB
Plaintext
46 lines
2.3 KiB
Plaintext
// floatlit_test — float LITERAL fold correctly-rounded, migrated from
|
|
// test/wcc/989_floatlit_run.c (#5-C4). The two stages once folded float
|
|
// literals differently: cstage via strtod (correctly rounded), wwstage via a
|
|
// pow-10 accumulation that was 1-2 ULP off on decimal fractions, overflowed its
|
|
// i64 accumulator past 19 mantissa digits, and missed DBL_MIN/DBL_MAX by up to
|
|
// 2 ULP (989 ratchet #59.10). The fix routes lexnum through strconv.stof64 (the
|
|
// Hare-ported correctly-rounded decimal engine).
|
|
//
|
|
// Each row reads back a literal's IEEE bits via a *u64 reinterpret and asserts
|
|
// the C-strtod-oracle bit pattern. The C driver ran (a) cstage build+run + (b)
|
|
// w6c-vs-w6c_ww .s byte-id; here the cstage run is test-lang (T1) and byte-id is
|
|
// test-lang-byteid (T2), so both dimensions survive. The overflow-reject leg
|
|
// (1.7976931348623159e308, both stages must reject) is the fold-3 runww carrier
|
|
// test/wcc/data/floatlit_overflow/case.ww.
|
|
|
|
package floatlit_test;
|
|
|
|
fn bits(v: f64) u64 = {
|
|
let x: f64 = v;
|
|
let p: *u64 = (&x): *u64;
|
|
return *p;
|
|
};
|
|
|
|
@test fn vectors() void = {
|
|
assert(bits(1.0000000000000002) == 0x3FF0000000000001u64);
|
|
assert(bits(9007199254740993.0) == 0x4340000000000000u64);
|
|
assert(bits(1.2345e67) == 0x4DDD4E421712C0B7u64);
|
|
assert(bits(0.1) == 0x3FB999999999999Au64);
|
|
assert(bits(1.1) == 0x3FF199999999999Au64);
|
|
assert(bits(123456789012345678901234567890.0) == 0x45F8EE90FF6C373Eu64);
|
|
assert(bits(2.2250738585072014e-308) == 0x0010000000000000u64);
|
|
assert(bits(0.3) == 0x3FD3333333333333u64);
|
|
assert(bits(3.141592653589793) == 0x400921FB54442D18u64);
|
|
assert(bits(1.7976931348623157e308) == 0x7FEFFFFFFFFFFFFFu64);
|
|
assert(bits(1.7976931348623158e308) == 0x7FEFFFFFFFFFFFFFu64);
|
|
assert(bits(7.2057594037927933e16) == 0x4370000000000000u64);
|
|
assert(bits(1000000000000000000000.0) == 0x444B1AE4D6E2EF50u64);
|
|
assert(bits(1_000.5) == 0x408F440000000000u64);
|
|
assert(bits(1.00000000000000011102230246251565404236316680908203125) == 0x3FF0000000000000u64);
|
|
assert(bits(1.00000000000000011102230246251565404236316680908203126) == 0x3FF0000000000001u64);
|
|
assert(bits(4503599627370497.5) == 0x4330000000000002u64);
|
|
assert(bits(0.5) == 0x3FE0000000000000u64);
|
|
assert(bits(1.0e308) == 0x7FE1CCF385EBC8A0u64);
|
|
assert(bits(2.225073858507202e-308) == 0x0010000000000001u64);
|
|
};
|