M. J. T. Guy [Fri, 24 Jul 1998 18:29:53 +0000 (19:29 +0100)]
Message-Id: <E0yzlfF-0004kz-00@taurus.cus.cam.ac.uk>
Subject: [PATCH] Re: Math::BigInt <=> op is not correct.
p4raw-id: //depot/maint-5.005/perl@1652
# Negate input value.
sub bneg { #(num_str) return num_str
local($_) = &bnorm(@_);
- vec($_,0,8) ^= ord('+') ^ ord('-') unless $_ eq '+0';
- s/^H/N/;
+ return $_ if $_ eq '+0' or $_ eq 'NaN';
+ vec($_,0,8) ^= ord('+') ^ ord('-');
$_;
}
} elsif ($y eq 'NaN') {
undef;
} else {
- &cmp($x,$y);
+ &cmp($x,$y) <=> 0;
}
}
=head1 Autocreating constants
After C<use Math::BigInt ':constant'> all the integer decimal constants
-in the given scope are converted to C<Math::BigInt>. This convertion
+in the given scope are converted to C<Math::BigInt>. This conversion
happens at compile time.
In particular
$test = 0;
$| = 1;
-print "1..246\n";
+print "1..247\n";
while (<DATA>) {
chop;
if (s/^&//) {
+124:+123:+1
-123:-124:+1
-124:-123:-1
++100:+5:+1
&badd
abc:abc:NaN
abc:+0:NaN