-
February 16th, 2022, 05:11 AM
#1
Testing for -nan (in the debugger)
We all know that when setting breakpoints we can specify a condition - for example it can be specified to stop only when a value is zero. Here's some code that's causing a problem for me:-
Code:
double
HighFrequencyAudioCurve::processDouble(const double *R__ mag, int increment)
{
double result = 0.0;
const int sz = m_lastPerceivedBin;
for (int n = 0; n <= sz; ++n) {
result = result + mag[n] * n; // <--- 'result' ends up as -nan
}
return result;
}
After going around the loop several hundred times, result ends up as -nan - but unfortunately, -nan isn't accepted as a condition for a breakpoint. VS gives me this dialog at runtime:-
Can anyone suggest some way to test for -nan ?
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
February 16th, 2022, 06:34 AM
#2
Re: Testing for -nan (in the debugger)
It's okay - I solved it by calling isnan() and placing a breakpoint if the return value was non-zero.
BTW - does anyone know what the statement double *R__ mag means..? I've never come across R__ before
[Edit...] If it helps, I just found that R__ is a #define saying #define R__ __restrict
Last edited by John E; February 16th, 2022 at 07:04 AM.
"A problem well stated is a problem half solved.” - Charles F. Kettering
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|