Add a signaling Nans rts option to ghc?

Ben Gamari ben at
Fri Sep 16 15:40:08 UTC 2016

Carter Schonwald <carter.schonwald at> writes:

> Hello All!
> I had some interesting conversations yesterday with a few folks and the
> take away was that I might experiment with adding an off by default rts
> flag that on applicable architectures that makes all floating point
> computations that yield Nans signaling , plus mayve some HS side hooks to
> enable or disable that per green thread if it doesn't harm no fib.  Kinda
> like the way green threads track and save / restore the state of the magic
> c error tracking variable
Sounds reasonable to me; debugging floating point issues is certainly a
chore and this could only help. Regarding a per-thread handling I think
we'd certainly need to benchmark. Note that rts/posix/Signals.c already has
some logic to handle SIGFPE, although it has been disabled for over a
decade due to an infinite loop where the handler immediately threw
another FPE. It would be nice to have a solution to this issue; looping
is quite bad.

Do you lump infinities into the class of NaN values? I'm not sure how
much code would fail due to "legitimate" uses of infinity if so.


- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <>

More information about the ghc-devs mailing list