Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Aug 2012 17:22:59 -0500
From:      Stephen Montgomery-Smith <stephen@missouri.edu>
To:        freebsd-numerics@freebsd.org
Subject:   Re: Complex arg-trig functions
Message-ID:  <50297E43.7090309@missouri.edu>
In-Reply-To: <50297CA5.5010900@missouri.edu>
References:  <5017111E.6060003@missouri.edu> <501C361D.4010807@missouri.edu> <20120804165555.X1231@besplex.bde.org> <501D51D7.1020101@missouri.edu> <20120805030609.R3101@besplex.bde.org> <501D9C36.2040207@missouri.edu> <20120805175106.X3574@besplex.bde.org> <501EC015.3000808@missouri.edu> <20120805191954.GA50379@troutmask.apl.washington.edu> <20120807205725.GA10572@server.rulingia.com> <20120809025220.N4114@besplex.bde.org> <5027F07E.9060409@missouri.edu> <20120814003614.H3692@besplex.bde.org> <50295F5C.6010800@missouri.edu> <20120814072946.S5260@besplex.bde.org> <50297CA5.5010900@missouri.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On 08/13/2012 05:16 PM, Stephen Montgomery-Smith wrote:
> On 08/13/2012 04:45 PM, Bruce Evans wrote:
>
>> y can have any sign I think.  But the problem only seemed to happen with
>> denormals and/or NaNs.  There might be a problem with NaNs not giving one
>> of the canceling negatives.
>
> OK.
>
>>>> @ --- 408,420 ----
>>>> @ @       if (ISFINITE(bx) && ISFINITE(by) && (x >
>>>> RECIP_SQRT_EPSILON_100 || y > RECIP_SQRT_EPSILON_100)) {
>>>> @ !         /* XXX following can also raise overflow */
>>>
>>> I don't see how the code could raise an overflow.  The output of clog
>>> should always be very much less than DBL_MAX.  (Originally I had
>>> clog(2*z), and that could raise an unwarranted overflow.)
>>
>> @       if (ISFINITE(bx) && ISFINITE(by) && (x > RECIP_SQRT_EPSILON_100
>> || y > RECIP_SQRT_EPSILON_100)) {
>> @ !         /* XXX following can also raise overflow */
>> @ !         if (huge+x+y>one) { /* raise inexact */
>> @ !             w = clog_for_large_values(z);
>> @ !             /* Can't add M_LN2 to w since it should clobber -0*I. */
>> @ !             rx = fabs(cimag(w));
>> @ !             ry = creal(w) + M_LN2;
>> @               if (sy == 0)
>> @ !                 ry = -ry;
>> @ !             return (cpack(rx, ry));
>> @           }
>> @       }
>>
>> clog() won't overflow spuriously, but huge+x+y might.
>
> Yes, I didn't think of that!
>
>> ((int)x == 0)' is a safer method of raising inexact for certain x.
>
> But this only works if x is less than 1.
>
> OK, how about this:
>
> sqrt_huge = 1e150;
> if (sqrt_huge+x>one || sqrt_huge+y>one) ...

Oops

if (sqrt_huge+x>one && sqrt_huge+y>one)





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50297E43.7090309>