On Feb 7, 5:35 pm, Ben Pfaff <b...@cs.stanford.eduwrote:
"Satish" <satishsantha...@gmail.comwrites:
What is the behaviour as per ANSI standard for HUGE_VAL * 0.0?
The standard doesn't say. It could be a NaN or 0, for example.
Also is there anywhere I can download ANSI standards for C/C++?
webstore.ansi.org
--
"If I've told you once, I've told you LLONG_MAX times not to
exaggerate."
--Jack Klein
Hi,
With your statement above my project could have been using a bad
design for years. Mine is a computationally intensive project. We
used to initialize variables with HUGE_VAL and project lived with it
even many comparison might have gone wrong when val * 0.0 was used.
As we moved to new compilers we identified this problem because the
new compiler returns NaN. So initializing to HUGE_VAL to my opinion
is bad design. At the sametime I cannot assign the variable with 0
because for example I use a check if val == HUGE_VAL update database
as NULL. I cannot do like val == 0 because the value indeed may be
computed to 0. So I was wondering do you think it is a good idea to
initialize variable with NaN. Does the standard say anything for NaN
* 0.0? At least the popular math functions when operated with NaN or
invalid values like fmod(-HUGE_VAL, 0) do they return HUGE_VAL or NaN?
Thanks,
Satish