Node:Arithmetic, Next:, Previous:Complex, Up:Numbers



21.2.11 Arithmetic Functions

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

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

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

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

abs x Scheme Procedure
scm_abs (x) C Function
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.

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

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

truncate Scheme Procedure
Round the inexact number x towards zero.

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

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

ceiling x Scheme Procedure
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.

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

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