[config] How does math_info report signalling NaN values?

How does math_info report signalling NaN values? I am trying to find regressions in a certain compiler config, and it fails math_info test as soon as it tries to evaluate the signalling NaN values - as it duly generates an unhandled signal and terminates. None of the other platforms appear to have this problem, or I can't see any obvious workaround if they do, yet the behaviour makes sense to me. Am I missing something obvious? -- AlisdairM

AlisdairM wrote:
How does math_info report signalling NaN values?
I am trying to find regressions in a certain compiler config, and it fails math_info test as soon as it tries to evaluate the signalling NaN values - as it duly generates an unhandled signal and terminates.
Borland eh? Math_info relies on numeric_limits to return the correct answers to it's queries: with Borland it reports that it *does* have a quiet NaN, but as soon as you *call* numeric_limits<>::quiet_NaN() the program aborts with an unhandled hardware exception! :-( Maybe we should add some #ifdef's in there so the program does at least run to completion? John.

John Maddock wrote:
AlisdairM wrote:
How does math_info report signalling NaN values?
I am trying to find regressions in a certain compiler config, and it fails math_info test as soon as it tries to evaluate the signalling NaN values - as it duly generates an unhandled signal and terminates.
Borland eh?
Math_info relies on numeric_limits to return the correct answers to it's queries: with Borland it reports that it *does* have a quiet NaN, but as soon as you *call* numeric_limits<>::quiet_NaN() the program aborts with an unhandled hardware exception! :-(
Maybe we should add some #ifdef's in there so the program does at least run to completion? My 0.02€: I've heard rumors about Borland enabling hardware exceptions for floating point. It can be manually set (which needs to be done for borland users coding OpenGL, otherwise they end up with divide-by-zero).
Perhaps set the control word and make Borland work in the tests as other compilers, and mentioning it in the docs (and/or test/assert, if possible?) Cheers, /Marcus

John Maddock wrote:
Borland eh?
No comment ;?)
Math_info relies on numeric_limits to return the correct answers to it's queries: with Borland it reports that it does have a quiet NaN, but as soon as you call numeric_limits<>::quiet_NaN() the program aborts with an unhandled hardware exception! :-(
The problem is not with quiet_NaN (a problem in the past) but with signalling_NaN. AFAICT, any attempt to evaluate this function should signal, if the platform suports traps. I don't understand how this works on other platforms, so don't know what kind of workaround may be necessary, other than commenting out that test entirely.
Maybe we should add some #ifdef's in there so the program does at least run to completion?
I am experimenting with this now. -- AlisdairM
participants (3)
-
AlisdairM
-
John Maddock
-
Marcus Lindblom