Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Aug 2012 19:32:25 -0500
From:      Stephen Montgomery-Smith <stephen@missouri.edu>
To:        freebsd-numerics@freebsd.org
Subject:   Re: Use of C99 extra long double math functions after r236148
Message-ID:  <50284B19.3000307@missouri.edu>
In-Reply-To: <20120727052006.GB92860@night.db.net>
References:  <20120717225328.GA86902@server.rulingia.com> <20120717232740.GA95026@troutmask.apl.washington.edu> <20120718001337.GA87817@server.rulingia.com> <20120718123627.D1575@besplex.bde.org> <20120722121219.GC73662@server.rulingia.com> <500DAD41.5030104@missouri.edu> <20120724113214.G934@besplex.bde.org> <501204AD.30605@missouri.edu> <20120727032611.GB25690@server.rulingia.com> <50121124.4000002@missouri.edu> <20120727052006.GB92860@night.db.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 07/27/2012 12:20 AM, Diane Bruce wrote:

> I was very curious about that. Any chance of running that test harness
> against the NetBSD routines? At least if we are very late we are very
> much better. ;-)

I just looked at the code used in NetBSD.  The code is rather simple, 
and no effort is made to avoid large numerical errors, nor to manage the 
edge cases:

https://www-asim.lip6.fr/trac/netbsdtsar/browser/vendor/netbsd/5/src/lib/libm/complex/cacosh.c?rev=2
https://www-asim.lip6.fr/trac/netbsdtsar/browser/vendor/netbsd/5/src/lib/libm/complex/cacos.c?rev=2
https://www-asim.lip6.fr/trac/netbsdtsar/browser/vendor/netbsd/5/src/lib/libm/complex/casin.c?rev=2

casin is like my proposed pseudo-code, which I realize is numerically 
unstable if |Re(z)| <= 1 and Im(z) is close to zero.

cacos(z) = Pi/2 - casin(z), which is subtracting two nearly equal 
quantities if z is close to 1.

cacosh computes the wrong branch: it should be sign(Im(z))*I*cacos(z).

clog is essentially log(cabs(z)) + I*arg(z), which can have a relative 
error close to infinity if |z|=1.

So I think we can do better.



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