summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-08-07 06:25:56 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-08-07 06:25:56 -0700
commit10eda95d8ed320f2dc10edd23bd7bdd238f13ace (patch)
tree5bd474b6a3a74dac950bc3d29fa612850e3bba2b /txr.1
parent9fb46f29b241253a31158012de3689bb654802e5 (diff)
downloadtxr-10eda95d8ed320f2dc10edd23bd7bdd238f13ace.tar.gz
txr-10eda95d8ed320f2dc10edd23bd7bdd238f13ace.tar.bz2
txr-10eda95d8ed320f2dc10edd23bd7bdd238f13ace.zip
New function: signum.
arith.c (signum): New function. (arith_init): signum intrinsic registered. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.125
1 files changed, 25 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 4f04d3aa..bced33a0 100644
--- a/txr.1
+++ b/txr.1
@@ -34863,6 +34863,31 @@ is positive, it is returned. If
is negative, its additive inverse is
returned: a positive number of the same type with exactly the same magnitude.
+.coNP Function @ signum
+.synb
+.mets (signum << number )
+.syne
+.desc
+The
+.code signum
+function calculates a representation of the sign of
+.meta number
+as a numeric value.
+
+If
+.meta number
+is an integer, then
+.code signum
+returns -1 if the integer is negative, 1 if the integer is positive,
+or else 0.
+
+If
+.meta number
+is a floating-point value then
+.code signum
+returns -1.0 if the value is negative, 1.0 if the value is positive or
+else 0.0.
+
.coNP Functions @, trunc @, floor @ ceil and @ round
.synb
.mets (trunc < dividend <> [ divisor ])