exp -- r7rs Definition
§

Kind
§

procedure;

Implemented by
§

Procedure signature
§

Procedure variants:

Exports
§

Exports recursive
§

Description
§

(exp z)
(log z)
(log z_1 z_2)
(sin z)
(cos z)
(tan z)
(asin z)
(acos z)
(atan z)
(atan y x)

These procedures compute the usual transcendental functions. The log procedure computes the natural logarithm of z (not the base ten logarithm) if a single argument is given, or the base-z_2 logarithm of z_1 if two arguments are given. The asin, acos, and atan procedures compute arcsine (sin^-1), arc-cosine (cos^-1), and arctangent (tan^-1), respectively. The two-argument variant of atan computes (angle (make-rectangular x y)) (see below), even in implementations that don't support complex numbers.

In general, the mathematical functions log, arcsine, arc-cosine, and arctangent are multiply defined. The value of log z is defined to be the one whose imaginary part lies in the range from -pi (inclusive if -0.0 is distinguished, exclusive otherwise) to pi (inclusive). The value of log 0 is mathematically undefined. With log defined this way, the values of sin^-1 z, cos^-1 z, and tan^-1 z are according to the following formulae: sin^-1 z = -i log(i z + sqrt(1 - z^2)) cos^-1 z = pi / 2 - sin^-1 z tan^-1 z = (log(1 + i z) - log(1 - i z)) / (2 i)

However, (log 0.0) returns -inf.0 (and (log -0.0) returns -inf.0+pi*i) if the implementation supports infinities (and -0.0).

The range of (atan y x) is as in the following table. The asterisk (*) indicates that the entry applies to implementations that distinguish minus zero.

|     | `y` condition | `x` condition | range of result `r` |
|     |   `y =  0.0`  |   `x >  0.0`  |  ` 0.0`             |
| `*` |   `y = +0.0`  |   `x >  0.0`  |  `+0.0`             |
| `*` |   `y = -0.0`  |   `x >  0.0`  |  `-0.0`             |
|     |   `y >  0.0`  |   `x >  0.0`  |  ` 0.0 < r < pi/2`  |
|     |   `y >  0.0`  |   `x =  0.0`  |  ` pi/2`            |
|     |   `y >  0.0`  |   `x <  0.0`  |  ` pi/2 < r < pi`   |
|     |   `y =  0.0`  |   `x <  0`    |  ` pi`              |
| `*` |   `y = +0.0`  |   `x <  0.0`  |  ` pi`              |
| `*` |   `y = -0.0`  |   `x <  0.0`  |  `-pi`              |
|     |   `y <  0.0`  |   `x <  0.0`  |  `-pi< r < -pi/2`   |
|     |   `y <  0.0`  |   `x =  0.0`  |  `-pi/2`            |
|     |   `y <  0.0`  |   `x >  0.0`  |  `-pi/2 < r < 0.0`  |
|     |   `y =  0.0`  |   `x =  0.0`  |  undefined          |
| `*` |   `y = +0.0`  |   `x = +0.0`  |  `+0.0`             |
| `*` |   `y = -0.0`  |   `x = +0.0`  |  `-0.0`             |
| `*` |   `y = +0.0`  |   `x = -0.0`  |  ` pi`              |
| `*` |   `y = -0.0`  |   `x = -0.0`  |  `-pi`              |
| `*` |   `y = +0.0`  |   `x =  0`    |  ` pi/2`            |
| `*` |   `y = -0.0`  |   `x =  0`    |  `-pi/2`            |

The above specification follows Common Lisp: The Language, second edition, which in turn cites Principal values and branch cuts in complex APL; refer to these sources for more detailed discussion of branch cuts, boundary conditions, and implementation of these functions. When it is possible, these procedures produce a real result from a real argument.


The text herein was sourced and adapted as described in the "R7RS attribution of various text snippets" appendix.

Referenced-types
§