4 ms·
How important is it to implement floating point arithmetic exactly as the standard specifies it? What if the same set of features is generally available, but no
by conistonwater 12y ago
How important is it to implement floating point arithmetic exactly as the standard specifies it? What if the same set of features is generally available, but not quite in the required way?
- StefanKarpinski 12y agoThat depends on what you want. Some people don't care at all, but others have legitimate needs for a lot of the features described in the spec. So if you can at all, it's best to follow the spec, imo. That way languages don't do a lot of annoyingly different, similar things. And, as this essay points out, the spec is wildly successful – it is arguably the most successful spec of all time – so second-guessing it is usually a mistake. Kahan at al. have forgotten more about numerical analysis than most of us will ever know.
- gre 12y agoFactor has a library for setting up floating point environments that might interest you. I think we implemented all of the functionality you might need and it's nestable with dynamic scoping. I haven't needed to use it for anything though. Code: https://github.com/slavapestov/factor/blob/master/basis/math/floats/env/env.factor https://github.com/slavapestov/factor/blob/master/basis/math... Tests: https://github.com/slavapestov/factor/blob/master/basis/math/floats/env/env-tests.factor https://github.com/slavapestov/factor/blob/master/basis/math... Docs: http://docs.factorcode.org/content/article-math.floats.env.html http://docs.factorcode.org/content/article-math.floats.env.h...
- nraynaud 12y agoa lot of analysis is based on ieee 754, that would mean developers would have to re-do the analysis and change the finicky algorithms. I'm personally not able to do it. I nod at the research papers I read, but I would not be able to write them.