detecting INF in a program

Is there a compiler option to stop execution if INF is encountered in an operation? I’m having some problems with INF being created in a program with quite a large amount of data, so I’d rather not have to test each element…
Thanks for any help!

Hi echorak,

You can use “-Ktrap=fp” to trap floating-point exceptions but there isn’t a flag to detect INF. You’ll need instrument your code use the functions “isinff” and “isinfd”.

  • Mat