Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 10 Apr 2018 15:50:07 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: catan errors

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.

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

View attachment "catan.diff" of type "text/plain" (688 bytes)

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ