From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12695 Path: news.gmane.org!.POSTED!not-for-mail From: "dgutson ." Newsgroups: gmane.linux.lib.musl.general Subject: Re: catan errors Date: Tue, 10 Apr 2018 17:41:46 -0300 Message-ID: References: <20180410195007.GI3094@brightrain.aerifal.cx> <20180410203206.GJ3094@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c05bc680c483a0569848d8d" X-Trace: blaine.gmane.org 1523392797 14912 195.159.176.226 (10 Apr 2018 20:39:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 10 Apr 2018 20:39:57 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-12711-gllmg-musl=m.gmane.org@lists.openwall.com Tue Apr 10 22:39:53 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1f603T-0003li-EP for gllmg-musl@m.gmane.org; Tue, 10 Apr 2018 22:39:51 +0200 Original-Received: (qmail 28606 invoked by uid 550); 10 Apr 2018 20:41:59 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 28588 invoked from network); 10 Apr 2018 20:41:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=2FiE0jHUflvp/lyczksATOiMsvvYOPW0SbTcPLIRkOo=; b=hAbIrJhcMNZSiYZyoAe86knGh1TGGn9Yg8d6fYAiJkFCZh3U791Dn6tA2h2aDwPccP svA5c6+CLGTFL5p1BVqmtURTfMw0DlqGRBER/c6CqYpPMD/TOaMA7wz46NK0vX/EUfTY cExv1q4TDwpdXjNpGrGNj4ymUsE1bL+jwpacpMtJ3gOdE1hv22PJQOnV4A5znbqRPgjK XWJ3nK0RJ8cjRA9Cp6cFopgZb9AA5zkTolGgBnGD55NqthcYCmbWnJkoAv/V77M/D+OL MZB5WAFtzd7JBvQaciSA7RWSMzh72UgOA3taDhWe38qmLKFa/lJmBIVsBzzWvNrMqKhG ixqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=2FiE0jHUflvp/lyczksATOiMsvvYOPW0SbTcPLIRkOo=; b=aQU+ure/PvHKeAIiL8bRvErnJfg8XhnzzZQIw0EClKB9EgdZSoRmeCLfE702MN5tEy D/sf+ZYnycHO24P6VgrhC+1nKQBUVudcQe02S5V+Geezzrzqu+1ulHeLcT6UP4tA2KiH L7uTRPEdjAfSOjT4/vMGg4r14It7ONJsJSxr0nJSOphEBynITnsC3wW43WgNTEGJcVHf zXvBxtXbIei4wf7FnI5m9Uo7oRq+GZU/tGkcJAV4rUbz8in8G6UaguPKNgHG3A8nxm+8 PqdknWDBxWSYvfqwEWGnscfj6sQ36ob6ZOrzd1sPDa6El239d9RwhN0qZ2P6rV/j50j9 v63g== X-Gm-Message-State: ALQs6tBSLlSNR1WziEQPwii+mxLeDxbNY3rOVtqsDvRn6MxFpweDXfGf QA/VmryiONELsxXDueYIuGvKYOecYU8SKU1qI5Kfdw== X-Google-Smtp-Source: AIpwx48c0r2OjKr/iDES3tA7fLeCv8DUDdUTP1wcekjq0BBeBmUXu5ACm6z4uV7H7vCty4EVGQj2k5bMfcmk1LvoQSE= X-Received: by 10.55.163.136 with SMTP id m130mr2859507qke.339.1523392906542; Tue, 10 Apr 2018 13:41:46 -0700 (PDT) In-Reply-To: <20180410203206.GJ3094@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:12695 Archived-At: --94eb2c05bc680c483a0569848d8d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 10, 2018 at 5:32 PM, Rich Felker wrote: > On Tue, Apr 10, 2018 at 05:23:12PM -0300, dgutson . wrote: > > On Tue, Apr 10, 2018 at 4:50 PM, Rich Felker 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=3D=3D1.0 and x=3D=3D0.0, which is the only r= eal > > > exceptional case for atan: z=3D=3DI. > > > > > > > > > Besides the trigonometric case, are you considering de-normalized > numbers, > > such as 4.94066e-324 as divisor? > > For example: > > double x =3D 1.0; > > double y =3D 5E-324; > > x / y is inf, and y !=3D 0.0. > > Shouldn't 'a' be checked against that number or its absolute value >=3D > > minimum? > > Can you clarify where you think something goes wrong? > - if (a =3D=3D 0.0) - goto ovrf; t =3D y + 1.0; a =3D (x2 + t * t)/a; The check you removed does not look correct for me because what I mentioned= . However, shouldn't you check, before the division, that a is not the nearest to zero (+ or -) denormalized representable double, in order to avoid ending in inf? > > Rich > --=20 Who=E2=80=99s got the sweetest disposition? One guess, that=E2=80=99s who? Who=E2=80=99d 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? --94eb2c05bc680c483a0569848d8d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Tue, Apr 10, 2018 at 5:32 PM, Rich Felker <dalias@libc.org> wrote:
On Tue, Apr = 10, 2018 at 05:23:12PM -0300, dgutson . wrote:
> 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<= br> > > nonsensical "overflow" (goto ovrf) conditions that aren= 't errors,
> > reported by mepholic on irc. I think the attached patch fixes the= m
> > without introducing new problems, but I'm not sure if any oth= er
> > 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 > >=C2=A0 =C2=A0 perfectly well-defined.
> >
> > 3. Is only possible if y=3D=3D1.0 and x=3D=3D0.0, which is the on= ly real
> >=C2=A0 =C2=A0 exceptional case for atan: z=3D=3DI.
> >
>
>
> Besides the trigonometric case, are you considering de-normalized numb= ers,
> such as 4.94066e-324 as divisor?
> For example:
>=C2=A0 =C2=A0 =C2=A0double x =3D 1.0;
>=C2=A0 =C2=A0 =C2=A0double y =3D 5E-324;
> x / y is inf, and y !=3D 0.0.
> Shouldn't 'a' be checked against that number or its absolu= te value >=3D
> minimum?

Can you clarify where you think something goes wrong?

-	if (a =3D=
=3D 0.0)
-		goto ovrf;
=20
 	t =3D y + 1.0;
 	a =3D (x2 + t * t)/a;

The check you removed does not = look correct for me because what I mentioned.
However, shouldn= 9;t you check, before the division, that a is not the nearest to zero (+ or= -) denormalized representable double,
in order to avoid ending i= n inf?

=C2=A0

Rich



--
Who=E2= =80=99s got the sweetest disposition?
One guess, that=E2=80=99s who?
= Who=E2=80=99d never, ever start an argument?
Who never shows a bit of te= mperament?
Who's never wrong but always right?
Who'd never dr= eam of starting a fight?
Who get stuck with all the bad luck?
--94eb2c05bc680c483a0569848d8d--