11
votes

I just spend my week messing with the subject, and found no language that get the IEEE 754 spec right.

Even GCC doesn't respect the relevant C99 part (it ignores the FENV_ACCESS pragma, and I've been told than my working examples were sheer luck).

It is impossible (AFAIK) to respect the spec with library functions, you need support from the language because some common optimizations are forbidden when you play with flags or rounding.

So here is my real question: are there languages out there (appart from C/C++ or raw assembly) that give me access to rounding modes, exception flags and calculus ?

3
Do you mean languages or language implementations? I assume you want the ability to test and change anything that can change (like rounding modes), rather than just IEEE 754 compliance in one model.David Thornley

3 Answers

2
votes

Since you're talking about the "hard" parts of IEEE 754, I'd guess your best bet would be to use Fortran. According to the Wikipedia article Fortran 2003 supports floating point exception handling at least.

0
votes

AFAIK, even FPU hardware units do not implement the complete IEEE-754 spec entirely. So, depending on what you need, you may be out of luck trying to get it. Maybe that is why no languages get it entirely right.

0
votes

I looks like Factor does it, and the link claims that D an SBCL too.