[racket-dev] flonum vs. inexact-real
At Sun, 3 Oct 2010 05:43:52 -0600,
Matthew Flatt wrote:
> Sam and Vincent: Any thoughts on how easy or difficult the change would
> be for Typed Racket (and its optimizer)?
It depends on how the 32-bit floats are integrated with the
library. If the existing library keeps using 64-bit floats as the
default, and primitives only return 32-bit floats when called only
with 32-bit floats, and the programmer has explicitly ask for 32-bit
floats (different reader syntax?), then it would be reasonably
easy. It would still be a significant amount of work, but the work
itself would not be too hard.
If the 32-bit floats are more integrated than that, things are likely
to become compilcated. Especially, I expect it would be fairly
confusing for users to accidentally end up with floats of two
different types. It would also make it harder for users to write
programs that would be optimized without extra effort. Now, as long as
you use floats, the optimizer can do a good job without you changing
your program in any way (except for the issues regarding exact
0). With a second float type that can pop up anywhere without the user
asking for it, users will have to start paying attention to which
float type they're using, which is extra work.
Vincent