Exception when casting doubles to ints
alan_baa at hotmail.com
Thu Jan 6 00:50:29 PST 2005
It appears that when a double that is larger than the maximum
int is cast to an int a floating point exception occurs. On cygwin
you do not get an exception, and as the code where I found the
problem was in lua I suspect other linux/unix variations also do not
raise an exception. Can anyone confirm the unix behaviour?
If this is the case should the RISC OS gcc match what unix does?
The following simple test program demonstrates the problem.
int main(int argc, char *argv)
double val = 2203180811.0;
k = (int)val;
printf("val %f, k %d\n", val, k);
More information about the gcc