Permalink
Browse files

Switch postfix:<¹> to postfix:<L> at sorear++'s suggestion.

  • Loading branch information...
1 parent 18a8910 commit e4158c1bdb31232c22c60745768201fdce5da314 @colomon committed Jan 30, 2011
Showing with 29 additions and 24 deletions.
  1. +5 −5 lib/Math/BigInt.pm
  2. +5 −0 t/01-basic.t
  3. +3 −3 t/02-arith.t
  4. +1 −1 t/03-playing.t
  5. +15 −15 t/04-compare.t
View
@@ -58,14 +58,14 @@ class Math::BigInt does Real {
method succ(Math::BigInt $x:) { bdIncrement($x.bd); self; }
method pred(Math::BigInt $x:) { bdDecrement($x.bd); self; }
- multi sub postfix:<¹>(Int $a) is export(:DEFAULT) {
- Math::BigInt.new(~$a);
- }
-
- multi sub postfix:<¹>(Str $a) is export(:DEFAULT) {
+ multi sub postfix:<L>(Str $a) is export(:DEFAULT) {
Math::BigInt.new($a);
}
+ multi sub postfix:<L>(Int $a) is export(:DEFAULT) {
+ Math::BigInt.new(~$a);
+ }
+
multi sub infix:<+>(Math::BigInt $a, Math::BigInt $b) is export(:DEFAULT) {
my $result = Math::BigInt.new("1");
bdAdd($result.bd, $a.bd, $b.bd);
View
@@ -40,4 +40,9 @@ plan *;
nok ($a - $a).Bool, "0 is false";
}
+{
+ isa_ok 1L, Math::BigInt, "1L creates a BigInt";
+ ok 1L, "and it's True";
+}
+
done;
View
@@ -125,11 +125,11 @@ plan *;
{
my @powers-of-three := Math::BigInt.new(1), * * 3 ... *;
for ^20 -> $i {
- is @powers-of-three[$i], 3¹ ** $i, "3 ** $i agrees (integer power)";
- is @powers-of-three[$i], 3¹ ** Math::BigInt.new($i), "3 ** $i agrees (Math::BigInt power)";
+ is @powers-of-three[$i], 3L ** $i, "3 ** $i agrees (integer power)";
+ is @powers-of-three[$i], 3L ** Math::BigInt.new($i), "3 ** $i agrees (Math::BigInt power)";
}
- is (2¹)**80, "1208925819614629174706176", "2**80 is 1208925819614629174706176";
+ is (2L)**80, "1208925819614629174706176", "2**80 is 1208925819614629174706176";
}
View
@@ -14,7 +14,7 @@ plan *;
}
{
- my @fib := 1¹, 1¹, *+* ... *;
+ my @fib := 1L, 1L, *+* ... *;
isa_ok @fib[200], Math::BigInt, "201st Fib is a BigInt";
is ~@fib[200], "453973694165307953197296969697410619233826",
"201st Fib is 453973694165307953197296969697410619233826";
View
@@ -3,22 +3,22 @@ use Test;
plan *;
-ok 4¹ < "54534624524525325234524354252"¹;
-ok 4¹ <= "54534624524525325234524354252"¹;
-ok 4¹ != "54534624524525325234524354252"¹;
-nok 4¹ > "54534624524525325234524354252"¹;
-nok 4¹ >= "54534624524525325234524354252"¹;
+ok 4L < "54534624524525325234524354252"L;
+ok 4L <= "54534624524525325234524354252"L;
+ok 4L != "54534624524525325234524354252"L;
+nok 4L > "54534624524525325234524354252"L;
+nok 4L >= "54534624524525325234524354252"L;
-ok 4¹ == 4¹;
-ok 4¹ <= 4¹;
-ok 4¹ >= 4¹;
-nok 4¹ < 4¹;
-nok 4¹ > 4¹;
+ok 4L == 4L;
+ok 4L <= 4L;
+ok 4L >= 4L;
+nok 4L < 4L;
+nok 4L > 4L;
-ok "54534624524525325234524354252"¹ == "54534624524525325234524354252"¹;
-ok "54534624524525325234524354252"¹ <= "54534624524525325234524354252"¹;
-ok "54534624524525325234524354252"¹ >= "54534624524525325234524354252"¹;
-nok "54534624524525325234524354252"¹ < "54534624524525325234524354252"¹;
-nok "54534624524525325234524354252"¹ > "54534624524525325234524354252"¹;
+ok "54534624524525325234524354252"L == "54534624524525325234524354252"L;
+ok "54534624524525325234524354252"L <= "54534624524525325234524354252"L;
+ok "54534624524525325234524354252"L >= "54534624524525325234524354252"L;
+nok "54534624524525325234524354252"L < "54534624524525325234524354252"L;
+nok "54534624524525325234524354252"L > "54534624524525325234524354252"L;
done;

0 comments on commit e4158c1

Please sign in to comment.