avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] [BUG] float: isnan & isinf


From: Bjarne Laursen
Subject: [avr-gcc-list] [BUG] float: isnan & isinf
Date: Tue, 23 Sep 2003 13:12:44 +0200

I have been doing som debugging in my program using floation point.
I used the definitions from http://www.psc.edu/general/software/packages/ieee/ieee.html

    {
        float a;
        float b;
        volatile float c;
        volatile BOOL x;
        a=0;
        b=100;
        c= b/a; // optimation inserts c=0x7F800000 (+Infinity)
        x=isnan(c); // returns 0
        x=isinf(c); // returns 0
    }

    {
        volatile float a;
        volatile float b;
        volatile float c;
        volatile BOOL x;
        a=0;
        b=100;
        c= b/a; // divide returns 0x7FC0000000 (Not a number)
        x=isnan(c); // returns 0
        x=isinf(c); // returns 0
    }

From the lst-file I found that 'isnan' checks for FC00XXXX and 'isinf' checks for FFFFFFFF or 7FFFFFFF. These tests are not correct.

-Bjarne Laursen, RoseTechnology



reply via email to

[Prev in Thread] Current Thread [Next in Thread]