Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Aug 2012 23:13:50 -0000
From:      Bruce Evans <brde@optusnet.com.au>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        Diane Bruce <db@db.net>, John Baldwin <jhb@freebsd.org>, David Chisnall <theraven@freebsd.org>, Stephen Montgomery-Smith <stephen@missouri.edu>, Bruce Evans <bde@freebsd.org>, Steve Kargl <sgk@troutmask.apl.washington.edu>, 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:  <20120719182849.T2190@besplex.bde.org>
Resent-Message-ID: <20120812231342.GE20453@server.rulingia.com>
In-Reply-To: <20120719144432.N1596@besplex.bde.org>
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>

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

> On Wed, 18 Jul 2012, Stephen Montgomery-Smith wrote:
>
>> I went on a long road trip yesterday, so I didn't get any code written, but 
>> I did have a lot of thoughts about clog and casinh.
>> 
>> First, the naive formula (here z=x+I*y)
>> clog(z) = cpack(log(hypot(x,y)),atan2(x,y))
>> is going to work in a lot more edge cases then one might expect.  This is 
>> because hypot and atan2, especially atan2, already do a rather good job 
>> getting the edge cases right.  I am thinking in particular of when x or y 
>> are 0 or -0, or one of them is infinity or -infinity.
>
> Right, clog is deceptively simple.  This is because it decomposes perfectly
> into 2 real functions of 2 real variables and both of these functions are
> standard and already implemented almost as well as possible.  ISTR das
> saying that it had a complicated case, but I don't see even one.  atan2()

Duh, I forget that log() must be applied to hypot().  You found the
surprisingly large inaccuracies from (too-?) simple avoidance of
overflow in hypot() soon after I first replied.  Is there a problem
even without overflow?  I think log contracts any errors in hypot()
so there isn't, but then why doesn't it contract any error in the
overflow avoidance?

Bruce



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