avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] Re: float replace addsf3.S subfs3.S mulsf3.S divsf3.S


From: Dmitry K.
Subject: Re: [avr-libc-dev] Re: float replace addsf3.S subfs3.S mulsf3.S divsf3.S floatsi.S
Date: Tue, 27 Feb 2007 13:15:56 +1000
User-agent: KMail/1.5

On Monday 26 February 2007 23:27, Hans-Jürgen Herbert wrote:
> In the test cases the NaN is not considered.

Look again:
    tests/simulate/fplib/add-nan.c, cmp-03.c, div-nan.c ...

> I added (so far) the follow
> lines in the test cases, and checked them on PC (not with Simulavr, but
> with the classical non cross compilers:
>
> On Windows 2000 with Visual Studio 5
> On Linux with GCC
>
> while avl-libc  with avr-gcc addsf3() returns in that 4 cases 0x7FD00000
>
> #define PNAN 0x7FC00000
> #define PINF 0x7F800000
> { { PNAN }, { 0 }, { PNAN } },
> { { 0 }, { PNAN }, { PNAN } },
> { { PINF }, { PNAN }, { PNAN } },
> { { PINF }, { PNAN }, { PNAN } },
>
> I had compiler errors with { .fl=2.0 } in the test cases.

If you write a test, please, take into account:
  1. If one or both float args is not a number, the comparison
operation '!=' will always 'true' and '==' will always 'false'.
It will be even in that case when both of argument coincide
on bits.
  2. If result of operation is NaN, it is not guaranteed any
concrete value. It may be 0x7fc00000, 0xffc00000, copy of
argument and so on. Use isnan() function or a construction
like:
        if (!(x <= 0) && !(x >= 0))
            puts ("x is not a number");

Regards,
Dmitry.





reply via email to

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