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: [PATCH] fdim(), fdimf() and fdiml() radically simplified
Date: Wed, 11 Dec 2019 11:39:36 +0100	[thread overview]
Message-ID: <20191211103935.GM23985@port70.net> (raw)
In-Reply-To: <530261068B3547C5A40104AC03005B28@H270>

* Stefan Kanthak <stefan.kanthak@nexgo.de> [2019-12-11 10:55:01 +0100]:
> Yet another optimisation/simplification in the math subtree.

these changes have incorrect fenv behaviour
(they signal the invalid exception on qnan input),
the result is fine though.

> 
> JFTR: I'm NOT subscribed to your mailing list, so CC: me in replies!
> 
> --- -/src/math/fdim.c
> +++ +/src/math/fdim.c
> @@ -3,8 +3,4 @@
>  double fdim(double x, double y)
>  {
> -        if (isnan(x))
> -                return x;
> -        if (isnan(y))
> -                return y;
> -        return x > y ? x - y : 0;
> +        return x <= y ? 0.0 : x - y;
>  }
> 
> --- -/src/math/fdimf.c
> +++ +/src/math/fdimf.c
> @@ -3,8 +3,4 @@
>  float fdimf(float x, float y)
>  {
> -        if (isnan(x))
> -                return x;
> -        if (isnan(y))
> -                return y;
> -        return x > y ? x - y : 0;
> +        return x <= y ? 0.0 : x - y;
>  }
> 
> --- -/src/math/fdiml.c
> +++ +/src/math/fdiml.c
> @@ -10,8 +10,4 @@
>  long double fdiml(long double x, long double y)
>  {
> -        if (isnan(x))
> -                return x;
> -        if (isnan(y))
> -                return y;
> -        return x > y ? x - y : 0;
> +        return x <= y ? 0.0 : x - y;
>  }


      reply	other threads:[~2019-12-11 10:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11  9:55 Stefan Kanthak
2019-12-11 10:39 ` 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=20191211103935.GM23985@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).