From bb30e8bc09ffaf5b7bf0ce7ecca17c55c8bf428d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 19 Mar 2014 00:07:48 -0700 Subject: * arith.c (tofloat, toint): New functions. * arith.h (tofloat, toint): Declared. * eval.c (eval_init): tofloat and toint registered as intrinsics. * txr.1: Documented. --- txr.1 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'txr.1') 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 ) + (toint []) + +.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 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 is an integer, then it is converted by tofloat as if by +the function flo-int. + +If 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 -- cgit v1.2.3