[GiNaC-list] Re: GiNaC-list Digest, Vol 29, Issue 1
Richard B. Kreckel
kreckel at ginac.de
Mon Jul 23 00:13:23 CEST 2007
Jan Bos wrote:
> Thanks for the prompt reply. I'm no expert and not aware of LIA-3. Maybe
> you could give me a reference as where to obtain it?
The links in <http://en.wikipedia.org/wiki/ISO/IEC_10967> appear to be
as good as it gets regarding downloadable stuff.
> The reason I posted the question is that since GiNaC is embedded in C++
> (beautiful concept by the way) it seems odd to have different
> definitions for the case at hand.
Surely, the intent is to avoid such differing definitions.
> Of course I can't oversee the
> consequences of a change, it would be convenient to code decisions based
> on the argument in a uniform way though.
Let's see. atan2 appears in LIA-2 and LIA-3, though not in LIA-1. It
isn't defined directly, but one finds for instance the formula in LIA-3:
ln(z)=ln(|z|)+I*atan2(y,x) for z=x+I*y. This implies to bring the branch
cut in alignment with the branch cut of ln(x+I*y). The latter is defined
as continuous with the second quadrant of the x-y plane (c.f. C99,
7.3.3.2: "[...] implementations shall map a cut so the function is
continuous as the cut is approached coming around the finite endpoint of
the cut in a counter clockwise direction. (Brnach cuts for the functions
specified here have just one finite endpoint.)" As I said, this branch
cut specification for ln(z) is consistent with the other standards.
IINM this implies that atan2(0,-4) should be +Pi, not -Pi.
Unless somebody is going to hold me back I'm going to fix this in GiNaC
RSN. I'll also consider some minor other issues like atan2(I*1.1,1.1)
throws an exception but atan2(I,1)->atan2(I,1) (both arguments of atan2
must be real, full stop.)
-richy.
--
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>
More information about the GiNaC-list
mailing list