www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000088

When Created: 06/06/1996 20:36:19
Against DJGPP version: 2.00
By whom: tj@lunar.eclipse.net
Abstract: Type conversion of (double) to (long) Causes floating point exception.
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);
}

Note added: 06/07/1996 06:09:23
By whom: terra@diku.dk (Morten Welinder)
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?

Solution added: 04/13/1999 08:00:54
By whom: eliz@is.elta.co.il
Upgrade to v2.02, where FP exceptions are masked by default.  You
will get a NaN for this case.

Fixed in version on 04/13/1999 08:00:26
By whom: eliz@is.elta.co.il



  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010