Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Aug 2012 23:11:33 -0000
From:      Stephen Montgomery-Smith <stephen@missouri.edu>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        Diane Bruce <db@db.net>, John Baldwin <jhb@freebsd.org>, David Chisnall <theraven@freebsd.org>, 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:  <500B594D.1020305@missouri.edu>
Resent-Message-ID: <20120812231125.GL20453@server.rulingia.com>
In-Reply-To: <20120721181204.A1702@besplex.bde.org>
References:  <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> <20120718205625.GA409@troutmask.apl.washington.edu> <500725F2.7060603@missouri.edu> <20120719025345.GA1376@troutmask.apl.washington.edu> <50077987.1080307@missouri.edu> <20120719032706.GA1558@troutmask.apl.washington.edu> <5007826D.7060806@missouri.edu> <5007AD41.9070000@missouri.edu> <20120719205347.T2601@besplex.bde.org> <50084322.7020401@missouri.edu> <20120720035001.W4053@besplex.bde.org> <50085441.4090305@missouri.edu> <20120720162953.N2162@besplex.bde.org> <20120720184114.B2790@besplex.bde.org> <50097128.6030405@missouri.edu> <20120721032448.X5744@besplex.bde.org> <5009BD6C.9050301@missouri.edu> <20120721123522.T877@besplex.bde.org> <500A2565.9090009@missouri.edu> <20120721181204.A1702@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------070704010607090802070100
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Three things.

1.  I think I now understand the casinh algorithm by Hull et al rather 
well.  I implemented it in the attached code.  Bruce, could you try it 
out against pari?  It did compare rather well to Mathematica's ArcSinh 
function.  I tested it mostly near the branch cut ends at I and -I. 
(The branch cut's behavior is somewhat similar to that of sqrt.)

After this, I think getting casin, cacos and cacosh should be relatively 
straightforward.  The hardest thing about cacos and cacosh will be 
figuring out where all the branch cuts and discontinuities are.

I also worked quite hard to avoid underflows and overflows from 
happening.  But I need to go through it again several times to check 
that the logic really works.

2.  I have thought more about the problem of computing clog(z) when |z| 
is close to 1.  I now think it might even require precision that is 3 
times better than double precision.  It is possible that you could, by 
chance, pick x and y so that |z| = 1 + 1e30.  (I wrote a test program, 
and this did actually happen a few times.)  So when you compute 
x^2+y^2-1, if you do it using double double precision, you will get 
2e30, but only the most significant digits will be accurate.  The ULP 
will be about 1e15.  You need triple double precision to get ULP's close 
to 1.

And I cannot even figure out how to do log(1+z) when z is close to 0! 
The trouble is, (1+x)^2+y^2-1 = 2x+x^2+y^2, and if x is negative and 
approximately -y^2, you are in the situation of subtracting nearly equal 
numbers!  (Obviously if z is very close to 0, I could use Taylor's series.)

3.  I haven't learned proper style yet.  (Is it what you call KNF?)  I 
have always had a distrust of consistency, especially when it comes to 
people's coding styles.  Sorry, but this is going to be a bit painful 
for me.

Stephen


--------------070704010607090802070100--



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