Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2012 13:40:25 -0500
From:      Stephen Montgomery-Smith <stephen@missouri.edu>
To:        freebsd-numerics@freebsd.org
Subject:   Re: Complex arg-trig functions
Message-ID:  <502A9B99.7090309@missouri.edu>
In-Reply-To: <502A8494.2050707@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> <50295887.2010608@missouri.edu> <20120814055931.Q4897@besplex.bde.org> <50297468.20902@missouri.edu> <20120814173931.V934@besplex.bde.org> <502A820C.6060804@missouri.edu> <502A8494.2050707@missouri.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
I was thinking more about the formulas of the type

casinhl(z) = clogl(z+csqrtl(z^2+1)).

It seems to be far more inaccurate than I originally thought.  mpc uses 
this method, and it tries to adjust the number of bits it uses until it 
get the right answer.  If you give it something like z = 1L + 
1e-3000L*I, mpc takes an extraordinarily large amount of time to do the 
calculation (it is worse for acos than for asin).

I added some printf statements to the code for mpc.  To calculate to 100 
bits, mpc is sometimes using a precision of 7000 bits for its internal 
calculations.

Also, for its acos and atan functions, it tries it with a certain number 
of bits, then adds a small number to the precision, and tries again. 
With asin, it at least multiples the precision by 1.5 with each retry. 
I adjusted the code so that acos and atan do the same as asin, and now 
it goes very much faster.

But they would still be better off using the Hull, Fairgrieve and Tang 
algorithm, which seems to be very superior.  And in their case they 
wouldn't have to worry about underflow and overflow.

I also looked at Mathematica.  It doesn't seem to use the above formula. 
  But whatever it does use, it is only marginally better.



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