Quantcast

Floating Point Exceptions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Floating Point Exceptions

Dominic Steinitz-2
Hello again,

I removed my dependency on hmatrix and enabled floating point exceptions via `feenableexcept` hoping to get a call stack showing me where the exception was being raised but alas all I get is

> *Main> main
> ghc: ghc-iserv terminated (-8)
> Leaving GHCi.


My googling didn’t turn up much but as far as I can tell ghc does *not* handle sigfpe (googling "haskell sigfpe” turns up blog posts on Haskell by someone called “sigfpe”). I think it would be jolly useful to be able to get stack traces of floating point exceptions. How much work would this be? I’d be happy to have a go at it if someone could provide help and guidance.

There seems to have been some discussion of it on the ghc-devs mailing list in September (https://mail.haskell.org/pipermail/ghc-devs/2016-September/date.html) but not much in the way of write up.

Dominic Steinitz
[hidden email]
http://idontgetoutmuch.wordpress.com

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Floating Point Exceptions

Carter Schonwald
Adding sigfpe handling doesn't have a writeupnyet because it's on my holiday project queue and the specifics of doing it nicely depend somewhat on the target architecture. 

If you want to get good errors in the mean time, register a sigfpe signal handler at the top level and invoke a smidge of c code to get info. 

Granted this doesn't give you a stack trace ...

On Wed, Dec 7, 2016 at 11:52 AM Dominic Steinitz <[hidden email]> wrote:
Hello again,



I removed my dependency on hmatrix and enabled floating point exceptions via `feenableexcept` hoping to get a call stack showing me where the exception was being raised but alas all I get is



> *Main> main

> ghc: ghc-iserv terminated (-8)

> Leaving GHCi.





My googling didn’t turn up much but as far as I can tell ghc does *not* handle sigfpe (googling "haskell sigfpe” turns up blog posts on Haskell by someone called “sigfpe”). I think it would be jolly useful to be able to get stack traces of floating point exceptions. How much work would this be? I’d be happy to have a go at it if someone could provide help and guidance.



There seems to have been some discussion of it on the ghc-devs mailing list in September (https://mail.haskell.org/pipermail/ghc-devs/2016-September/date.html) but not much in the way of write up.



Dominic Steinitz

[hidden email]

http://idontgetoutmuch.wordpress.com



_______________________________________________

Glasgow-haskell-users mailing list

[hidden email]

http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Loading...