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

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

### 21.2.13 Primitive Numeric Functions

Many of Guile's numeric procedures which accept any kind of numbers as arguments, including complex numbers, are implemented as Scheme procedures that use the following real number-based primitives. These primitives signal an error if they are called with complex arguments.

Scheme Procedure: \$abs x
Return the absolute value of x.

Scheme Procedure: \$sqrt x
Return the square root of x.

Scheme Procedure: \$expt x y
C Function: scm_sys_expt (x, y)
Return x raised to the power of y. This procedure does not accept complex arguments.

Scheme Procedure: \$sin x
Return the sine of x.

Scheme Procedure: \$cos x
Return the cosine of x.

Scheme Procedure: \$tan x
Return the tangent of x.

Scheme Procedure: \$asin x
Return the arcsine of x.

Scheme Procedure: \$acos x
Return the arccosine of x.

Scheme Procedure: \$atan x
Return the arctangent of x in the range -PI/2 to PI/2.

Scheme Procedure: \$atan2 x y
C Function: scm_sys_atan2 (x, y)
Return the arc tangent of the two arguments x and y. This is similar to calculating the arc tangent of x / y, except that the signs of both arguments are used to determine the quadrant of the result. This procedure does not accept complex arguments.

Scheme Procedure: \$exp x
Return e to the power of x, where e is the base of natural logarithms (2.71828...).

Scheme Procedure: \$log x
Return the natural logarithm of x.

Scheme Procedure: \$sinh x
Return the hyperbolic sine of x.

Scheme Procedure: \$cosh x
Return the hyperbolic cosine of x.

Scheme Procedure: \$tanh x
Return the hyperbolic tangent of x.

Scheme Procedure: \$asinh x
Return the hyperbolic arcsine of x.

Scheme Procedure: \$acosh x
Return the hyperbolic arccosine of x.

Scheme Procedure: \$atanh x
Return the hyperbolic arctangent of x.

For the hyperbolic arc-functions, the Guile library exports C functions corresponding to these Scheme procedures, but taking and returning arguments of type `double` rather than the usual `SCM`.

C Function: double scm_asinh (double x)
C Function: double scm_acosh (double x)
C Function: double scm_atanh (double x)
Return the hyperbolic arcsine, arccosine or arctangent of x respectively.

For all the other Scheme procedures above, except `expt` and `atan2` (whose entries specifically mention an equivalent C function), the equivalent C functions are those provided by the standard mathematics library. The mapping is as follows.

 Scheme Procedure C Function `\$abs` `fabs` `\$sqrt` `sqrt` `\$sin` `sin` `\$cos` `cos` `\$tan` `tan` `\$asin` `asin` `\$acos` `acos` `\$atan` `atan` `\$exp` `exp` `\$log` `log` `\$sinh` `sinh` `\$cosh` `cosh` `\$tanh` `tanh`

Naturally, these C functions expect and return `double` arguments.

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

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