Subject: | batan2() does not handle inf/-inf properly |
From the POSIX man page of atan2:
Show quoted text
> | For finite values of ± y > 0, if x is -Inf, ±pi shall be returned.
> | For finite values of ± y > 0, if x is +Inf, ±0 shall be returned.
> | For finite values of x, if y is ±Inf, ±pi/2 shall be returned.
> | If y is ±Inf and x is -Inf, ±3pi/4 shall be returned.
> | If y is ±Inf and x is +Inf, ±pi/4 shall be returned.
>
Currently:
# perl -Mbignum -wle 'print 1->batan2(-inf)'
Ambiguous use of -inf resolved as -&inf() at -e line 1.
Illegal division by zero at
/usr/share/perl/5.8/Math/BigInt/Calc.pm
line 806.
# perl -Mbignum -wle 'print 1->batan2(+inf)'
Illegal division by zero at
/usr/share/perl/5.8/Math/BigInt/Calc.pm
line 806.
# perl -Mbignum -wle 'print inf->batan2(1)'
1
# perl -Mbignum -wle 'print inf->batan2(-inf)'
Ambiguous use of -inf resolved as -&inf() at -e line 1.
1
# perl -Mbignum -wle 'print inf->batan2(+inf)'
1