| One of the many reasons I think we all would've been better off, had Brendan Eich decided he'd been able to simply use Scheme within the crazy time constraint he'd been given, rather than create JavaScript, :) is that Scheme comes with a distinction between exact and inexact numbers, in its numerical tower: https://en.wikipedia.org/wiki/Numerical_tower One change I'd consider making to Scheme, and to most high-level general-purpose languages (that aren't specialized for number-crunching or systems programming), is to have the reader default to reading numeric literals as exact. For example, the current behavior in Racket and Guile: Welcome to Racket v7.3.
> (+ 0.1 0.2)
0.30000000000000004
> (+ #e0.1 #e0.2)
3/10
> (exact->inexact (+ #e0.1 #e0.2))
0.3
So, I'd lean towards getting the `#e` behavior without needing the `#e` in the source.By default, that would give the programmer in this high-level language the expected behavior. And systems programmers, people writing number-crunching code, would be able to add annotations when they want an imprecise float or an overflowable int. (I'd also default to displaying exact fractional rational numbers using familiar decimal point conventions, not the fractional form in the example above.) |