forked from alex-eg/sex
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:
@@ -769,6 +769,10 @@
|
||||
(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"
|
||||
|
||||
Reference in New Issue
Block a user