p4raw-id: //depot/perl@33676
sub tan { sin($_[0]) / cos($_[0]) }
-Note that atan2(0, 0) is not well-defined, however the Perl
-implmentation returns C<0> for this value.
+Perl returns C<undef> for C<atan(0,0)>.
=item bind SOCKET,NAME
X<bind>
dVAR; dSP; dTARGET; tryAMAGICbin(atan2,0);
{
dPOPTOPnnrl;
- SETn(Perl_atan2(left, right));
+ if (left == 0.0 && right == 0.0)
+ SETs(&PL_sv_undef);
+ else
+ SETn(Perl_atan2(left, right));
RETURN;
}
}
require './test.pl';
}
-plan tests => 16;
+plan tests => 17;
# compile time evaluation
# atan2() tests were removed due to differing results from calls to
# atan2() on various OS's and architectures. See perlport.pod for
# more information.
+
+# Just test that atan2(0,0) is undef, because that's implemented
+# from within perl.
+ok(!defined(atan2(0,0)), 'atan2(0,0) returns undef');