mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: Stefan Kanthak <stefan.kanthak@nexgo.de>
Cc: musl@lists.openwall.com
Subject: Re: Re: [updated/fixed] Patches for math subtree
Date: Wed, 11 Dec 2019 10:37:15 +0100	[thread overview]
Message-ID: <20191211093714.GI23985@port70.net> (raw)
In-Reply-To: <D107A03BFBA6431AB6778ADB104ED655@H270>

* Stefan Kanthak <stefan.kanthak@nexgo.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;
> -        }


      reply	other threads:[~2019-12-11  9:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 16:56 Stefan Kanthak
2019-12-11  9:37 ` Szabolcs Nagy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191211093714.GI23985@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    --cc=stefan.kanthak@nexgo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).