Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Aug 2012 23:13:57 -0000
From:      Bruce Evans <brde@optusnet.com.au>
To:        Stephen Montgomery-Smith <stephen@missouri.edu>
Cc:        Diane Bruce <db@db.net>, Steve Kargl <sgk@troutmask.apl.washington.edu>, John Baldwin <jhb@freebsd.org>, David Chisnall <theraven@freebsd.org>, Bruce Evans <bde@freebsd.org>, Bruce Evans <brde@optusnet.com.au>, David Schultz <das@freebsd.org>, Peter Jeremy <peter@rulingia.com>, Warner Losh <imp@bsdimp.com>
Subject:   Re: Use of C99 extra long double math functions after r236148
Message-ID:  <20120720120802.F1061@besplex.bde.org>
Resent-Message-ID: <20120812231349.GG20453@server.rulingia.com>
In-Reply-To: <50083E83.9090404@missouri.edu>
References:  <20120529045612.GB4445@server.rulingia.com> <20120711223247.GA9964@troutmask.apl.washington.edu> <20120713114100.GB83006@server.rulingia.com> <201207130818.38535.jhb@freebsd.org> <9EB2DA4F-19D7-4BA5-8811-D9451CB1D907@theravensnest.org> <C527B388-3537-406F-BA6D-2FA45B9EAA3B@FreeBSD.org> <20120713155805.GC81965@zim.MIT.EDU> <20120714120432.GA70706@server.rulingia.com> <20120717084457.U3890@besplex.bde.org> <5004A5C7.1040405@missouri.edu> <5004DEA9.1050001@missouri.edu> <20120717200931.U6624@besplex.bde.org> <5006D13D.2080702@missouri.edu> <20120719144432.N1596@besplex.bde.org> <50083E83.9090404@missouri.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 19 Jul 2012, Stephen Montgomery-Smith wrote:

> On 07/19/2012 01:37 AM, Bruce Evans wrote:
>> ...
>> problem.  Complex functions should have only poles and zeros, with
>> projective infinity and "projective zero" (= inverse of projective
>> infinity).  Real functions can and do have affine infinities and zeros
>> (+-Inf and +-0), with more detailed special cases.  It's just impossible
>> to have useful, detailed special cases for all the ways of approaching
>> complex (projective) infinity and 0.
>> ...
>> sign functions).  Hopefully, the specification of imag(clog()) is
>> that it has the same sign behaviour as atan2(), so you can just use
>> atan2().  The sign conventions for both are arbitrary, but they
>> shouldn't be gratuitously different.  You still have to check that
>> they aren't non-gratuitously different, because different conventions
>> became established.
>
> I checked.  Actually the sign conventions are not that arbitrary.  But as a 
> mathematician I would say they are a bit useless, e.g.
> atan(infinity,infinity) = pi/4 = 45 degrees
> How do you know that the two infinities are the same?  One could be double 
> the other.

It should be NaN with projective infinity.

> If it had been up to me, there would have been finite numbers, and nan.  And 
> none of this -0.

I think Kahan is a mathematician, and is primarily responsible for +-0.
+-0 give poor man's branch cuts for real functions.

>> I don't know what happens with zeros of complex inverse trig functions.
>> I think they don't have many (like log()), but their real and imaginary
>> parts do, and they are too general for accurate behaviour of the real
>> and imaginary parts relative to themselves to fall out.
>
> casinh(z) is zero only when z=0, and near that point I could use Taylor's 
> series (but a lot of terms would be needed because the Taylot series 
> converges quite slowly).

To get accuracy near zeros, you only need to use a series method in a
very small radius.  Even a linear approximation may be enough, and the
main difficulty is the linear term:

 	f() ~= f'(z0) * (z-z0)

where z0 typically needs to be known to hundreds or thousands of bits of
precision and the subtraction must be done in this precision.  f'(z0) and
the multiplkication only need a couple of extra bits.  This is only easy
when z0 is a dyadic rational.

> I can now see that the separate cases of the real part and imaginary parts of 
> casinh being zero is going to be hard.

I won't ask for that and will measure errors relative to the absolute value
of the result.

Bruce



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