read hex floats

0x1.8p3 was no number to the reader, so it became a symbol C got inside
|pipes|, and _ could not type it. It reads now as a literal written as
it was: the digits of a double's own bits, which no decimal rounds to.
This commit is contained in:
2026-10-16 14:44:29 +03:00
parent c1c6a3dd15
commit 1cfa80595e
5 changed files with 55 additions and 16 deletions

View File

@@ -826,6 +826,10 @@ whitespace aside, THEN?"
(test-assert "a float keeps its digits, which a double would round"
(emits? (in-fn "(var x (long double) 3.14159265358979323846264338327950288L)")
"x = 3.14159265358979323846264338327950288L;"))
(test-assert "a hex float is written as it was"
(emits? (in-fn "(var x double 0x1.8p3)") "x = 0x1.8p3;"))
(test-assert "suffix and all"
(emits? (in-fn "(var x float -0x1p-2f)") "x = -0x1p-2f;"))
(test-assert "grouped digits reach C ungrouped"
(emits? (in-fn "(var x float 1_000.5f)") "x = 1000.5f;"))
(test-assert "a minus is C's own"