summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-03-19 00:07:48 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-03-19 00:07:48 -0700
commitbb30e8bc09ffaf5b7bf0ce7ecca17c55c8bf428d (patch)
tree8400d4ff248929e63f0cfd28b9880b7d01a87dad /txr.1
parentee3464c68375f00a6cf44b4bfad8bdbda4e17d32 (diff)
downloadtxr-bb30e8bc09ffaf5b7bf0ce7ecca17c55c8bf428d.tar.gz
txr-bb30e8bc09ffaf5b7bf0ce7ecca17c55c8bf428d.tar.bz2
txr-bb30e8bc09ffaf5b7bf0ce7ecca17c55c8bf428d.zip
* arith.c (tofloat, toint): New functions.
* arith.h (tofloat, toint): Declared. * eval.c (eval_init): tofloat and toint registered as intrinsics. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.126
1 files changed, 26 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index b9a1e2e7..4dbc7dbe 100644
--- a/txr.1
+++ b/txr.1
@@ -10317,6 +10317,32 @@ The flo-int function returns an exact floating point value corresponding to the
integer argument, if possible, otherwise an approximation using a nearby
floating point value.
+.SS Functions tofloat and toint
+
+.TP
+Syntax:
+
+ (tofloat <value>)
+ (toint <value> [<radix>])
+
+.TP
+Description:
+
+These convenience functions convert a given value to a floating-point value or
+to an integer, respectively.
+
+If a floating-point value is passed into tofloat, or an integer value into
+toint, then the value is simply returned.
+
+If <value> is a string, then it is converted by tofloat as if by the
+function flo-str, and by toint as if by the function int-str.
+
+If <value> is an integer, then it is converted by tofloat as if by
+the function flo-int.
+
+If <value> is a floating-point number, then it is converted by toint
+as if by the function int-flo.
+
.SH BIT OPERATIONS
In TXR Lisp, similarly to Common Lisp, bit operations on integers are based