[GiNaC-list] atan2(0,-4) = -Pi?
Jan Bos
jb68 at xs4all.nl
Sat Jul 21 21:24:57 CEST 2007
Dear All,
Is there a reason for GiNaC (or ginsh) to evaluate
atan2(0,-4) as -Pi instead of +Pi the definition used by for instance
C/C++? Looking at the code, inifcns_trans.cpp last shown case below,
explicitly states it should. Or can I expect it to be changed in the
future?
static ex atan2_eval(const ex & y, const ex & x)
{
if (y.info(info_flags::numeric) && x.info(info_flags::numeric)) {
if (y.is_zero()) {
// atan(0, 0) -> 0
if (x.is_zero())
return _ex0;
// atan(0, x), x real and positive -> 0
if (x.info(info_flags::positive))
return _ex0;
// atan(0, x), x real and negative -> -Pi
if (x.info(info_flags::negative))
return _ex_1*Pi;
}
...
The code fragment is from version 1.3.7
best regards
Jan Bos
More information about the GiNaC-list
mailing list