[LCP]Detecting overflow of floating point calculations

Chuck Martin nrocinu at myrealbox.com
Tue Jun 25 22:53:06 UTC 2002


What's the best way to detect overflow during floating point calculations?
I know that I know that if a floating point number is larger than the
maximum value it can hold, the printf() family of functions will print
"inf", at least with gcc, so printing to a string with sprintf() and then
testing the result would work, but is it portable?  And is there a better
way?  It seems to me that there ought to be  Thanks.

Chuck





More information about the linuxCprogramming mailing list