[racket-dev] flonum vs. inexact-real

From: Neil Toronto (neil.toronto at gmail.com)
Date: Sat Oct 2 19:12:20 EDT 2010

Robby Findler wrote:
> Is there any value to, on a 64 bit machine, having 32 bit floats be
> immediate values to avoid boxing?

It would certainly be faster than 64-bit boxed floats.

You could get better precision with 62-bit unboxed floats, stealing a 
couple of bits from the exponent, doing 64-bit ops, and boxing results 
when they overflow. Guarding flops with a couple of bit-level ops 
wouldn't be much slower, and you'd always have equal or better 
precision, even when you have to round them to 32 bits.

What I'm saying is, you can get what appears to be a better 
speed/precision trade-off without complicating the numeric tower.

@Matthew: is there a problem with declaring "float" to mean 
"platform-dependent floating-point format?" Embedded devices don't 
always easily support 64 bits, and I'd hate to be stuck with 64 if 
128-bit floats become ubiquitous.

Neil T

Posted on the dev mailing list.