Complex arg-trig functions

Bruce Evans brde at optusnet.com.au
Thu Sep 13 14:01:05 UTC 2012


On Thu, 13 Sep 2012, Stephen Montgomery-Smith wrote:

> I'll look over these changes.  But let me say one thing.  When the code is 
> committed, I am intending that clog_for_large_values will be replaced by clog 
> (or clogf or clogl), which will be your code.  So I am not going to worry too 
> much about fixing up clog_for_large_values.

I think it should be remain separate.  It only needs very special subcases
of clog(), and has already these cases, so it can be about twice as fast
for the log(|z|) part by not repeating things and by taking advantage of
the specialness.  The atan2() part can't be simplified much.  For the
log(|z|) part, the best method is approximately to scale x and y down to
near 1 and then just use x*x + y*y.  I tried this in clog() too, but it
didn't work so well there because it only handles 1 subcase and it gets
in the way of other, more interesting cases.  The scaling step may be too
messy for clog_for_large_values() too.  If so, I would copy the relevant
part of the current algorithm from clog() to here.  This would be slightly
smaller than the current clog_for_large_values().

Bruce


More information about the freebsd-numerics mailing list