LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect underflow in pow()?

Solved!
Go to solution

In this case, checking for FP_SUBNORMAL won't help much, since the pow function just returns a plain, old 0.0 double, in case of underflow.

 

Luis

0 Kudos
Message 11 of 14
(925 Views)

Dear Luis,

 

I agree that the question on FP_SUBNORMAL has only little to do with the original question, but when would it be set? Once that C99 if fully implemented? Or is it more an omission of the pow function?

0 Kudos
Message 12 of 14
(923 Views)

Full C99 compliance would require functions/macros such as these.

 

At this point, I'm not sure exactly what it would take for fpclassify to return a status of FP_SUBNORMAL. My understanding is that even the full C99 spec does not require the pow function to return anything other than 0.0 on underflow, and I would think that 0.0 is not a subnormal number but, to be honest, I'm not sure.

 

Luis

Message 13 of 14
(915 Views)

Thanks, Luis!

 

Probably you are right, after reading more about subnormal numbers I would not expect this message to show up, as it is not really related to underflow. It is related to this thread.

 

So even if this thread did not solve my initial problem, once in a while I learn something new, about negative zeros, subnormal numbers, funny animals Smiley Happy

0 Kudos
Message 14 of 14
(906 Views)