summaryrefslogtreecommitdiff
path: root/dist/Math-BigInt/t/bigintpm.inc
diff options
context:
space:
mode:
authorPeter John Acklam <pjacklam@online.no>2011-03-07 11:45:38 +0100
committerFather Chrysostomos <sprout@cpan.org>2011-06-11 12:14:25 -0700
commit7833bfdd94cb7b5afbbc1b18e75e664482f529d5 (patch)
treea415ddbaf2b70fb787243d402b707555d000baf8 /dist/Math-BigInt/t/bigintpm.inc
parent074ededac3b0d3c126e0affff0c86afc1257e665 (diff)
downloadperl-7833bfdd94cb7b5afbbc1b18e75e664482f529d5.tar.gz
Add sign function bsgn() as a complement to babs().
This is the standard mathematical signum function. It sets the invocand to -1, 0, or 1, if it is real, and NaN otherwise. Documentation and tests are included.
Diffstat (limited to 'dist/Math-BigInt/t/bigintpm.inc')
-rw-r--r--dist/Math-BigInt/t/bigintpm.inc9
1 files changed, 8 insertions, 1 deletions
diff --git a/dist/Math-BigInt/t/bigintpm.inc b/dist/Math-BigInt/t/bigintpm.inc
index e52a2713d3..478584bc4e 100644
--- a/dist/Math-BigInt/t/bigintpm.inc
+++ b/dist/Math-BigInt/t/bigintpm.inc
@@ -73,7 +73,7 @@ while (<DATA>)
} elsif ($f eq "bone") {
$try .= "\$x->bone('$args[1]');";
# some unary ops
- } elsif ($f =~ /^b(nan|floor|ceil|sstr|neg|abs|inc|dec|not|sqrt|fac)$/) {
+ } elsif ($f =~ /^b(nan|floor|ceil|sstr|neg|abs|sgn|inc|dec|not|sqrt|fac)$/) {
$try .= "\$x->$f();";
} elsif ($f =~ /^(numify|length|stringify|as_hex|as_bin)$/) {
$try .= "\$x->$f();";
@@ -1222,6 +1222,13 @@ babsNaN:NaN
-1:1
+123456789:123456789
-123456789:123456789
+&bsgn
+NaN:NaN
++inf:1
+-inf:-1
+0:0
++123456789:1
+-123456789:-1
&bcmp
bcmpNaN:bcmpNaN:
bcmpNaN:0: