Re:FastDoubleParser: Java port of Daniel Lemires fast_double...
by ygra on Monday March 22, 2021 @04:28PM
(#26546479)
I guess Swift just adopted a similar thing to -ffast-math which some C compilers offer where guarantees about precision of floating-point operations are thrown away to get a similar result faster. Incidentally, that could deserve a better name as well (oh, there seems to be a -funsafe-math-optimizations, which reads a lot closer to what is intended).
[ Parent
| on HN ]
Re:FastDoubleParser: Java port of Daniel Lemires fast_double...
by cozzyd on Monday March 22, 2021 @10:47PM
(#26550431)
Who wouldn't want some fun, safe, math optimizations!
I still don't think it's very descriptive though. Whether or not it's unsafe depends a lot on the domain. In most of my code, I don't care about the sign of zero or floating point associativity and want my compiler to auto convert division to multiplication by reciprocals. Better would be something like -fnon-compliant-float-math or something.
Although I guess -fno-trapping-math is a bit different from the other optimizations which could actually be "unsafe" in a different way, since signaling nans are quite useful for debugging.
Re:FastDoubleParser: Java port of Daniel Lemires fast_double...
by j16sdiz on Tuesday March 23, 2021 @01:03AM
(#26551316)
In java, method need 'strictfp' modifier to get correct math.