- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Re: Scala @strictfp support?
Fri, 2009-02-06, 00:47
>>>>> "Jon" == Jon Pretty writes:
Jon> Doing a quick grep of the Scala source code, strictfp isn't used
Jon> (but the compiler is vaguely aware of it, for completeness,
Jon> presumably). I suspect the reason it's not supported is lack of
Jon> demand. Java got away without it until version 5, didn't it?
strictfp has been around for over 10 years -- since Java 1.2.
It's important to some scientific users.
Most users justifiably don't care, but if you're doing some kinds of
scientific computing, then exact reproducibility of floating point
results cross-platform is important. For example, in our simulation
tool NetLogo, we promise users that if they run their simulation with
the same random seed, they'll get the same results every time, no matter
what computer they're on. This ensures that published simulation
results can be reproduced. And that promise rests on Java's strictfp
promise.
It's also convenient for testing purposes (in any application domain)
not to have to worry about whether results can vary slightly from
machine to machine.
It would certainly be nice if Scala supported strictfp declarations (an
annotation instead of a keyword would be fine). I don't have any actual
simulation engine code in Scala right now, but when I do, I guess I'll
have to find a way to post-process the class files generated by scalac
in order to set the strictfp flag.
--j
On Thu, Feb 5, 2009 at 3:46 PM, Seth Tisue <seth@tisue.net> wrote: