www.delorie.com/gnu/docs/guile/guile_180.html search
Guile Reference Manual

 [ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 21.2.11 Arithmetic Functions

Scheme Procedure: + z1 ...
Return the sum of all parameter values. Return 0 if called without any parameters.

Scheme Procedure: - z1 z2 ...
If called with one argument z1, -z1 is returned. Otherwise the sum of all but the first argument are subtracted from the first argument.

Scheme Procedure: * z1 ...
Return the product of all arguments. If called without arguments, 1 is returned.

Scheme Procedure: / z1 z2 ...
Divide the first argument by the product of the remaining arguments. If called with one argument z1, 1/z1 is returned.

Scheme Procedure: abs x
C Function: scm_abs (x)
Return the absolute value of x.

x must be a number with zero imaginary part. To calculate the magnitude of a complex number, use `magnitude` instead.

Scheme Procedure: max x1 x2 ...
Return the maximum of all parameter values.

Scheme Procedure: min x1 x2 ...
Return the minimum of all parameter values.

Scheme Procedure: truncate
Round the inexact number x towards zero.

Scheme Procedure: round x
Round the inexact number x towards zero.

Scheme Procedure: floor x
Round the number x towards minus infinity.

Scheme Procedure: ceiling x
Round the number x towards infinity.

For the `truncate` and `round` procedures, the Guile library exports equivalent C functions, but taking and returning arguments of type `double` rather than the usual `SCM`.

C Function: double scm_truncate (double x)
C Function: double scm_round (double x)

For `floor` and `ceiling`, the equivalent C functions are `floor` and `ceil` from the standard mathematics library (which also take and return `double` arguments).

 [ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]

 webmaster delorie software   privacy Copyright © 2003   by The Free Software Foundation Updated Jun 2003