[Mono-dev] Non-un comparition of floats

Zoltan Varga vargaz at gmail.com
Mon Feb 12 14:05:54 EST 2007


Hi,

beq should fail if the arguments are unordered, and negative infinity
is unordered
with itself.

   Zoltan

On 2/12/07, Sergey Tikhonov <tsv at solvo.ru> wrote:
> Hello Zoltan,
>
> I implemented non-un comparition of floats according your suggestion.
> Running tests recently I got to the following problem (jit-floats.cs
> test_nan method).
>
> The following code:
> ...
> double neg_inf1 = Double.NegativeInfinity;
> double neg_inf2 = Double.NegativeInfinity;
> double pos_inf1 = Double.PositiveInfinity;
> double pos_inf2 = Double.PositiveInfinity;
> ...
> if (neg_inf1 != neg_inf2)
>         return err;
> ...
>
> is translated to:
> CODE BLOCK 6 (nesting 0):
>  (stind.i4 local[6] (add (ldind.i4 local[6]) iconst[1]))
>  (beq[B8B9] (compare (ldind.r8 local[2]) (ldind.r8 local[3])))
> CODE BLOCK 9 (nesting 0):
>  (setret (ldind.i4 local[6]))
>  br[B1]
> CODE BLOCK 8 (nesting 0):
>  (stind.i4 local[6] (add (ldind.i4 local[6]) iconst[1]))
>
> As it is non-un compare it fails. :( Should it fail only if one argument
> is unordered? (Like in your example nan < 1.0) or for equal/not-equal
> compare we should check for unordered args too?
>
> Thank you,
>
> --
> Sergey Tikhonov
>
> Head, R&D department
> Solvo Ltd.
> Saint-Petersburg, Russia
> http://www.solvo.ru
> tsv at solvo.ru
>
>
>



More information about the Mono-devel-list mailing list