I disagree about automation. Compilers should never silently lose information. Lisp had it right a long time ago: default to fixed point + real fractions and only allow floating point math when explicitly requested.
I think, with current languages, that would probably be the right way to do it. It's not beyond the realms of possibility for a language to try and do the right thing (with sane and predictable rules of course), and let the user override it with their preference.
The hardest part would be getting those sane defaults, otherwise everyone will override them anyway, and you're back to square one or worse.
Sane defaults shouldn't hard at all. Just like in Python you have to do Decimal('1.0') now, we could just as well have to do Float(1.0) to override the default.
Clojure has with-precision [1] and Common Lisp has defaulted to fixed point, fractions and explicit ^float type annotations.
Comments
I disagree about automation. Compilers should never silently lose information. Lisp had it right a long time ago: default to fixed point + real fractions and only allow floating point math when explicitly requested.
I think, with current languages, that would probably be the right way to do it. It's not beyond the realms of possibility for a language to try and do the right thing (with sane and predictable rules of course), and let the user override it with their preference.
The hardest part would be getting those sane defaults, otherwise everyone will override them anyway, and you're back to square one or worse.
Sane defaults shouldn't hard at all. Just like in Python you have to do Decimal('1.0') now, we could just as well have to do Float(1.0) to override the default.
Clojure has with-precision [1] and Common Lisp has defaulted to fixed point, fractions and explicit ^float type annotations.
[1] http://clojuredocs.org/clojure_core/clojure.core/with-precis...