DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH

# (guile.info.gz) Primitive Numerics Info Catalog (guile.info.gz) Scientific (guile.info.gz) Numbers (guile.info.gz) Bitwise Operations
```
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.

``` Info Catalog (guile.info.gz) Scientific (guile.info.gz) Numbers (guile.info.gz) Bitwise Operations
automatically generated byinfo2html