| www.delorie.com/djgpp/bugs/show.cgi | search |
When the following is function called with "x = test(2147483648.0);" it will
cause a floating point exception when trying to do the type conversion from long
to double.
long test(double dvar)
{
long lvar;
lvar = (long)dvar;
return(lvar);
}I could be mistaken, but isn't that a very sensible reaction? 2^31 does not have a representation as a (long). So, what do you think should happen in this situation? And why?
Upgrade to v2.02, where FP exceptions are masked by default. You will get a NaN for this case.
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2010 by DJ Delorie | Updated Jul 2010 |