lib/strconv: f64tos Ryū shortest float→string (#106 fold-5a)

Graduate f64tos from the lossy fixed-point placeholder to Ryū shortest-
round-trippable (ftos.ha:432 + ftos_ryu.ha). f64tos(n:f64) str, G-format
(void/NONE) — the faithful documented subset (full parametric fftosf is
dead code for G/void/NONE → deferred #64). Ryū core decomposed: struct-
RETURN + scalar params (Hare's r128 idiom; avoids tuple-ABI #163-166).
f64 powers tables [15][2]/[13][2]u64 (2D #156). Zero float literals.
Both E+F encode paths reachable+tested, no dead code.

Graduation (lib-note "don't keep both"): old lossy f64tos deleted; fmt
fprintf_f64_huge "huge"→"9.5e18" (improvement). 5 value-faithful filed-
bug dodges (byte-id, documented): #167/#169/#170/#43/#144. Test 908.
Make test 186/186 incl 990-997 byte-id + combined_ww_fresh.

Drew's strconv 5-fold plan — primary completion (f64tos). f32tos coda
#67 (behind #143); parametric ftosf #64.
This commit is contained in:
2026-05-27 15:39:03 +09:00
parent 81796cd533
commit 0e66073e32
11 changed files with 3219 additions and 762 deletions

View File

@@ -526,11 +526,13 @@ fn formatraw(out: *io.stream, arg: formattable, m: *mods) (i32 | io.closed) = {
//
// Mods scope: width / alignment / pad / sign honored via
// the same raw-then-pad machinery as i64. `prec` ignored —
// strconv.f64tos has no precision knob; graduate when a
// Ryū-shaped strconv lands and mods grows ffmt / fflags.
// `base` ignored (Hare does too — base is int-only).
// NaN/±Inf print as whatever strconv emits today (garbage);
// strconv detection blocked on f64↔u64 bit-reinterpret cgen.
// strconv.f64tos is shortest-G with no precision knob; grows a
// precision path when mods gains ffmt / fflags (the parametric
// ftosf, strconv task #64). `base` ignored (Hare does too —
// base is int-only). NaN/±Inf now render as "nan"/"infinity"
// (Ryū graduation, fold-5); the uniform sign-peel below would
// turn a SHOW_POS nan into "+nan" (a minor fmt-layer edge, not
// strconv's — strconv emits a bare "nan").
let view: str = strconv.f64tos(v);
let neg_flag: bool = false;
if (view.len > 0 && view.ptr[0] == 45u8) { // '-'