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==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?