mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "dgutson ." <danielgutson@gmail.com>
To: musl@lists.openwall.com
Subject: Re: catan errors
Date: Tue, 10 Apr 2018 17:23:12 -0300	[thread overview]
Message-ID: <CAFdMc-1cijofmRZoW+uS3D7higcYHVtuevX2Y2dT40Hegq2guw@mail.gmail.com> (raw)
In-Reply-To: <20180410195007.GI3094@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 1714 bytes --]

On Tue, Apr 10, 2018 at 4:50 PM, Rich Felker <dalias@libc.org> wrote:

> The OpenBSD catan implementation we're using has a number of
> nonsensical "overflow" (goto ovrf) conditions that aren't errors,
> reported by mepholic on irc. I think the attached patch fixes them
> without introducing new problems, but I'm not sure if any other
> problems remain.
>
> Note that, of the three cases removed:
>
> 1. Is not an exceptional case at all, and made no sense to begin with.
>
> 2. Is only exceptional if x and a are both zero; atan(2x,0) is
>    perfectly well-defined.
>
> 3. Is only possible if y==1.0 and x==0.0, which is the only real
>    exceptional case for atan: z==I.
>


Besides the trigonometric case, are you considering de-normalized numbers,
such as 4.94066e-324 as divisor?
For example:
    double x = 1.0;
    double y = 5E-324;
x / y is inf, and y != 0.0.
Shouldn't 'a' be checked against that number or its absolute value >=
minimum?


>
> I opted to replace the non-obvious (3) with an explicit check for z==I
> but this isn't necessary.
>
> As written the patch does not address raising exception flags; that
> should be fixed before it's committed but right now I'm just
> submitting this for comments.
>
> Prior to the patch, at least the following (utterly dumb -- the first
> is a very real input!) cases are broken:
>
> - catan(1.0)
> - catan(2*I)
> - catan(I)
>
> Rich
>



-- 
Who’s got the sweetest disposition?
One guess, that’s who?
Who’d never, ever start an argument?
Who never shows a bit of temperament?
Who's never wrong but always right?
Who'd never dream of starting a fight?
Who get stuck with all the bad luck?

[-- Attachment #2: Type: text/html, Size: 2528 bytes --]

  reply	other threads:[~2018-04-10 20:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10 19:50 Rich Felker
2018-04-10 20:23 ` dgutson . [this message]
2018-04-10 20:32   ` Rich Felker
2018-04-10 20:41     ` dgutson .
2018-04-10 20:50       ` Rich Felker
2018-04-10 21:27         ` dgutson .
2018-04-10 22:14           ` Rich Felker
2018-04-10 23:08 ` Szabolcs Nagy
2018-04-10 23:23   ` Rich Felker
2018-04-11  0:52     ` Szabolcs Nagy

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=CAFdMc-1cijofmRZoW+uS3D7higcYHVtuevX2Y2dT40Hegq2guw@mail.gmail.com \
    --to=danielgutson@gmail.com \
    --cc=musl@lists.openwall.com \
    /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).