[racket-dev] Single-precision floats
Single and double precision floating-point numbers have different read
syntax but print the same way.
Welcome to Racket v5.0.99.6.
> 1.0e0
1.0
> (flonum? 1.0e0)
#t
> 1.0f0
1.0
> (flonum? 1.0f0)
#f
Is this a bug?
Also, it seems there's no read syntax for single-precision specials
(nan and infinities), even though they exist.
> +nan.0
+nan.0
> (flonum? +nan.0)
#t
> (/ 0.0f0 0.0f0)
+nan.0
> (flonum? (/ 0.0f0 0.0f0))
#f
I could add +nan.0f0 (or any exponent) and others. For symmetry, I
could also add +nan.0e0 and others as syntax for double-precision
specials.
It would also be nice to have conversion functions to convert between
the two kinds of floating-point numbers.
If nobody objects, I'll implement that.
Vincent