bad floating point exception

Les hlhowell at pacbell.net
Sat Jul 28 20:41:48 UTC 2007


On Fri, 2007-07-27 at 14:26 -0400, Mike - EMAIL IGNORED wrote:
> On FC4, with:
> $ g++ --version
> g++ (GCC) 4.0.2 20051125 (Red Hat 4.0.2-8)
> 
> I ran, in essence:
> 
>    unsigned    x = <seconds in the epoch>;
>    unsigned    y = 0; // an error
>    if (x % y == 0)
>       ...
> 
> I got a floating point exception.  Peculiar?

I see that you have commented that y=0 is an error, I assume that you
are using that internally.  If you do mod any number with 0, that is a
math error because it is a divide by zero exception.  Why it came up as
floating point exception would depend on how the compiler arbitrated the
evaluation of the if clause I think.

Regards,
Les H




More information about the fedora-list mailing list