write a double in the digits that read back as it
CHICKEN prints 15 significant digits unless told otherwise, too few to name every double: 0.9871465422297019 reached the C as 0.987146542229702, a different constant. Found in vs-map-viewer, where 380 literals in a port that has to match .NET bit for bit changed this way. The shortest spelling that reads back is written, up to 17 digits.
This commit is contained in:
@@ -789,7 +789,18 @@ whitespace aside, THEN?"
|
||||
(test-assert "a subscript"
|
||||
(emits? (in-fn "(var xs [int 4]) (var n size-t (sizeof [xs 0]))") "sizeof(xs[0])")))
|
||||
|
||||
;; A define's body was pasted unwalked, and unparenthesised: `cast'
|
||||
;; A double is written in as few digits as read back as the same
|
||||
;; double: CHICKEN prints 15 by default, and 0.16666666666666666 came
|
||||
;; out 0.166666666666667, another number
|
||||
(test-group "double literals"
|
||||
(test-assert "keep every digit they need"
|
||||
(emits? (in-fn "(var d double 0.16666666666666666)") "d = 0.16666666666666666;"))
|
||||
(test-assert "and gain none they do not"
|
||||
(emits? (in-fn "(var d double 0.1)") "d = 0.1;"))
|
||||
(test-assert "sixteen when that is enough"
|
||||
(emits? (in-fn "(var d double 0.9871465422297019)") "d = 0.9871465422297019;")))
|
||||
|
||||
;; A define's body was pasted unwalked, and unparenthesised: `cast'
|
||||
;; stayed a call, and (* x D) regrouped with D's own operator
|
||||
(test-group "defines"
|
||||
(test-assert "an atom is left bare"
|
||||
|
||||
Reference in New Issue
Block a user