if ($x eq "NaN" || $y eq "NaN") {
undef;
} else {
+ local($xm,$xe,$ym,$ye) = split('E', $x."E$y");
+ if ($xm eq '+0' || $ym eq '+0') {
+ return $xm <=> $ym;
+ }
ord($y) <=> ord($x)
- ||
- ( local($xm,$xe,$ym,$ye) = split('E', $x."E$y"),
- (($xe <=> $ye) * (substr($x,$[,1).'1')
- || Math::BigInt::cmp($xm,$ym))
- );
+ || ($xe <=> $ye) * (substr($x,$[,1).'1')
+ || Math::BigInt::cmp($xm,$ym);
}
}
$test = 0;
$| = 1;
-print "1..358\n";
+print "1..362\n";
while (<DATA>) {
chop;
if (s/^&//) {
$try .= "0+\$x->fsqrt;";
} else {
$try .= "\$y = new Math::BigFloat \"$args[1]\";";
- if ($f eq fcmp){
+ if ($f eq "fcmp") {
$try .= "\$x <=> \$y;";
- }elsif ($f eq fadd){
+ } elsif ($f eq "fadd") {
$try .= "\$x + \$y;";
- }elsif ($f eq fsub){
+ } elsif ($f eq "fsub") {
$try .= "\$x - \$y;";
- }elsif ($f eq fmul){
+ } elsif ($f eq "fmul") {
$try .= "\$x * \$y;";
- }elsif ($f eq fdiv){
+ } elsif ($f eq "fdiv") {
$try .= "\$x / \$y;";
} else { warn "Unknown op"; }
}
+1:-1:1
-1:-1:0
+1:+1:0
+-1.1:0:-1
++0:-1.1:1
++1.1:+0:1
++0:+1.1:-1
+123:+123:0
+123:+12:1
+12:+123:-1