Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Sep 2012 00:00:55 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Stephen Montgomery-Smith <stephen@missouri.edu>
Cc:        freebsd-numerics@freebsd.org
Subject:   Re: Complex arg-trig functions
Message-ID:  <20120913232218.E2426@besplex.bde.org>
In-Reply-To: <5051DBD9.9080200@missouri.edu>
References:  <5017111E.6060003@missouri.edu> <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> <50295F5C.6010800@missouri.edu> <20120814072946.S5260@besplex.bde.org> <50297CA5.5010900@missouri.edu> <50297E43.7090309@missouri.edu> <20120814201105.T934@besplex.bde.org> <502A780B.2010106@missouri.edu> <20120815223631.N1751@besplex.bde.org> <502C0CF8.8040003@missouri.edu> <20120906221028.O1542@besplex.bde.org> <5048D00B.8010401@missouri.edu> <504D3CCD.2050006@missouri.edu> <504FF726.9060001@missouri.edu> <20120912191556.F1078@besplex.bde.org> <20120912225847.J1771@besplex.bde.org> <50511B40.3070009@missouri.edu> <20120913204808.T1964@besplex.bde.org> <5051DBD9.9080200@missouri.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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