Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191211093714.GI23985@port70.net>
Date: Wed, 11 Dec 2019 10:37:15 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: Stefan Kanthak <stefan.kanthak@...go.de>
Cc: musl@...ts.openwall.com
Subject: Re: Re: [updated/fixed] Patches for math subtree

* Stefan Kanthak <stefan.kanthak@...go.de> [2019-12-10 17:56:51 +0100]:
> > Just some optimisations.

thanks for the patches.

i think optimizing |x|<1 is not very important.

c99 allowed 2 fenv behaviours, we (and fdlibm) choose
one, c2x went with the other: no inexact exception is
allowed.

so if i touch this code i would rewrite it with int
arithmetics (which will be slower on most hard float
targets than the current code anyway)

> 
> JFTR: I'm NOT subscribed to your mailing list, so CC: me in replies!
> 
> [ Patch for remquo unchanged ]
> 
> --- -/src/math/ceil.c
> +++ +/src/math/ceil.c
> @@ -18,10 +18,10 @@
> +        /* special case because of non-nearest rounding modes */
> +        if (e < 0x3ff) {
> +                FORCE_EVAL(x + toint);
> +                return u.i >> 63 ? -0.0 : 1.0;
> +        }
>          /* y = int(x) - x, where int(x) is an integer neighbor of x */
>          if (u.i >> 63)
>                  y = x - toint + toint - x;
>          else
>                  y = x + toint - toint - x;
> -        /* special case because of non-nearest rounding modes */
> -        if (e <= 0x3ff-1) {
> -                FORCE_EVAL(y);
> -                return u.i >> 63 ? -0.0 : 1;
> -        }
> 
> --- -/src/math/floor.c
> +++ +/src/math/floor.c
> @@ -18,10 +18,10 @@
> +        /* special case because of non-nearest rounding modes */
> +        if (e < 0x3ff) {
> +                 FORCE_EVAL(x + toint);
> +                 return u.i >> 63 ? -1.0 : 0.0;
> +        }
>          /* y = int(x) - x, where int(x) is an integer neighbor of x */
>          if (u.i >> 63)
>                  y = x - toint + toint - x;
>          else
>                  y = x + toint - toint - x;
> -        /* special case because of non-nearest rounding modes */
> -        if (e <= 0x3ff-1) {
> -                 FORCE_EVAL(y);
> -                 return u.i >> 63 ? -1 : 0;
> -        }

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.