[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] [Bug] float: 0/0 =2
From: |
Dave Hansen |
Subject: |
Re: [avr-gcc-list] [Bug] float: 0/0 =2 |
Date: |
Tue, 23 Sep 2003 10:08:16 -0400 |
From: Bjarne Laursen <address@hidden>
I discovered another bug in the float libary:
{
volatile float a;
volatile float b;
volatile float c;
a=0;
b=0;
c= b/a; // divide returns 0x40000000 (2.0)
}
That's not technically a bug. At least, not in avr-gcc.
According to n869 6.5.5p5, if the right-hand operand of either the "/" or
"%" operators has the value zero, the behavior is undefined. Undefined
behavior may include behavior you expect (perhaps +Inf or NaN), but it may
include behavior you do not expect (such as 2.0 or nasal demons).
Regards,
-=Dave
_________________________________________________________________
High-speed Internet access as low as $29.95/month (depending on the local
service providers in your area). Click here. https://broadband.msn.com