The transcendentals Module

The transcendentals module, exported from the common-dylan library, provides a set of generic functions for ANSI C-like behavior over real numbers. The restrictions and error cases described in this document are intended to be the same as they are in ANSI C.

The single module, transcendentals, exports these generic functions and methods.

Because implementation of these functions might be by a standard library for transcendentals accessed by a foreign function interface, the exact precision and algorithms (and hence, the exact results) for all of these functions is explicitly unspecified. Note, however, that a program expects the following, even in libraries that are implemented by calling foreign libraries:

  • Domain and range errors should be signalled as Dylan errors.

  • Floating point precision contagion must obey Dylan rules (that is, functions called on single precision values return single precision results, and functions on double precision values return double precision results)

Reference

This section contains a reference entry for each item exported from the common-dylan library’s transcendentals module.

^ Generic function
Summary

Returns its first argument, raised to the power indicated by its second argument.

Signature

^ b x => y

Parameters
  • b – An instance of type <real>.

  • x – An instance of type <real>.

Values
  • y – An instance of type <real>.

Discussion

Returns b raised to the power x. If b is 0 and x is not positive, an error is signalled. If b is negative and x is not an integer, an error is signalled.

If b and x are both integers, the result is an integer. If x is negative, an error is signalled.

The floating point precision is given by the precision of b.

See also

acos Generic function
Summary

Returns the arc cosine of its argument.

Signature

acos x => y

Parameters
  • x – an instance of type <real>. The angle, in radians. If x is not in the range [-1,+1], an error is signalled.

Values
  • y – An instance of type <float>.

Discussion

Returns the arc cosine of its argument. The floating point precision of the result is given by the precision of x.

See also

acosh Generic function
Summary

Returns the hyperbolic arc cosine of its argument.

Signature

acosh x => y

Parameters
  • x – An instance of type <real>. The angle, in radians.

Values
  • y – An instance of type <float>.

Discussion

Returns the hyperbolic arc cosine of its argument. The floating point precision of the result is given by the precision of x.

See also

asin Generic function
Summary

Returns the arc sine of its argument.

Signature

asin x => y

Parameters
  • x – An instance of type <real>. The angle, in radians. If x is not in the range [-1,+1], an error is signalled.

Values
  • y – An instance of type <float>.

Discussion

Returns the arc sine of its argument. The floating point precision of the result is given by the precision of x.

See also

asinh Generic function
Summary

Returns the hyperbolic arc sine of its argument.

Signature

asinh x => y

Parameters
  • x – An instance of type <real>. The angle, in radians.

Values
  • y – An instance of type <float>.

Discussion

Returns the hyperbolic arc sine of its argument. The floating point precision of the result is given by the precision of x.

See also

atan Generic function
Summary

Returns the arc tangent of its argument.

Signature

atan x => y

Parameters
  • x – An instance of type <real>. The angle, in radians. If x is not in the range [-1,+1], an error is signalled.

Values
  • y – An instance of type <float>.

Discussion

Returns the arc tangent of its argument. The floating point precision of the result is given by the precision of x.

See also

atan2 Generic function
Summary

Returns the arc tangent of one angle divided by another.

Signature

atan2 x y => z

Parameters
  • x – An instance of type <real>. The first angle, in radians.

  • y – An instance of type <real>. The second angle, in radians.

Values
  • z – An instance of type <float>.

Discussion

Returns the arc tangent of x divided by y. x may be zero if y is not zero. The signs of x and y are used to derive what quadrant the angle falls in.

The floating point precision of the result is given by the precision of x/y.

atanh Generic function
Summary

Returns the hyperbolic arc tangent of its argument.

Signature

atanh x => y

Parameters
  • x – An instance of type <real>. The angle, in radians.

Values
  • y – An instance of type <float>.

Discussion

Returns the hyperbolic arc tangent of its argument. The floating point precision of the result is given by the precision of x.

See also

cos Generic function
Summary

Returns the cosine of its argument.

Signature

cos x => y

Parameters
  • x – An instance of type <real>. The angle, in radians.

Values
  • y – An instance of type <float>.

Discussion

Returns the cosine of its argument. The floating point precision of the result is given by the precision of x.

See also

cosh Generic function
Summary

Returns the hyperbolic cosine of its argument.

Signature

cosh x => y

Parameters
  • x – An instance of type <real>. The angle, in radians.

Values
  • y – An instance of type <float>.

Discussion

Returns the hyperbolic cosine of its argument. The floating point precision of the result is given by the precision of x.

See also

$double-e Constant
summary

The value of e, the base of natural logarithms, as a double precision floating point number.

type

<double-float>

superclasses

<float>

description

The value of e, the base of natural logarithms, as a double precision floating point number.

See also

$double-pi Constant
Summary

The value of π as a double precision floating point number.

Type

<double-float>

Superclasses

<float>

Discussion

The value of π as a double precision floating point number.

See also

exp Generic function
Summary

Returns e, the base of natural logarithms, raised to the power indicated by its argument.

Signature

exp x => y

Parameters
  • x – An instance of type <real>.

Values
  • y – An instance of type <float>.

Discussion

Returns e, the base of natural logarithms, raised to the power x. The floating point precision is given by the precision of x.

See also

hypot Generic function
Summary

Returns the Euclidian distance.

Signature

hypot x, y => z

Parameters
Values
Discussion

Returns the Euclidian distance without unnecessary overflow or underflow.

The floating point precision is given by the precision of x.

isqrt Generic function
Summary

Returns the integer square root of its argument.

Signature

isqrt x => y

Parameters
Values
Discussion

Returns the integer square root of x, that is the greatest integer less than or equal to the exact positive square root of x. If x < 0, an error is signalled.

See also

log Generic function
Summary

Returns the natural logarithm of its argument.

Signature

log x => y

Parameters
  • x – An instance of type <real>.

Values
  • y – An instance of type <float>.

Discussion

Returns the natural logarithm of x to the base e. If x <= 0 <= 1, an error is signalled. The floating point precision of the result is given by the precision of x.

See also

logn Function
Summary

Returns the logarithm of its argument to the given base.

Signature

logn x b => y

Parameters
Values
Discussion

Returns the logarithm of x to the base b. If x <= 0 <= 1, an error is signalled. The floating point precision of the result is given by the precision of x.

See also

ilog2 Function
Summary

Returns the base two logarithm of its argument, truncated to an integer.

Signature

ilog2 x => y

Parameters
Values
Discussion

Returns the integer base two logarithm of x, that is the greatest integer less than or equal to the exact base two logarithm of x.

See also

sin Generic function
Summary

Returns the sine of its argument.

Signature

sin x => y

Parameters
  • x – An instance of type <real>. The angle, in radians.

Values
  • y – An instance of type <float>.

Discussion

Returns the sine of its argument. The floating point precision of the result is given by the precision of x.

See also

sincos Generic function
Summary

Returns both the sine and the cosine of its argument.

Signature

sincos x => (s, c)

Parameters
  • x – An instance of type <real>. The angle, in radians.

Values
  • s – An instance of type <float>. The result of sin(x).

  • c – An instance of type <float>. The result of cos(x).

Discussion

Returns both the sine and the cosine of its argument. The floating point precision of the results is given by the precision of x.

See also

cos sin

$single-e Constant
Summary

The value of e, the base of natural logarithms, as a single precision floating point number.

Type

<single-float>

Superclasses

<float>

Discussion

The value of e, the base of natural logarithms, as a single precision floating point number.

See also

$single-pi Constant
Summary

The value of π as a single precision floating point number.

Type

<single-float>

Superclasses

<float>

Discussion

The value of π as a single precision floating point number.

See also

sinh Generic function
Summary

Returns the hyperbolic sine of its argument.

Signature

sinh x => y

Parameters
  • x – An instance of type <real>. The angle, in radians.

Values
  • y – An instance of type <float>.

Discussion

Returns the hyperbolic sine of its argument. The floating point precision of the result is given by the precision of x.

See also

sqrt Generic function
Summary

Returns the square root of its argument.

Signature

sqrt x => y

Parameters
  • x – An instance of type <real>.

Values
  • y – An instance of type <float>.

Discussion

Returns the square root of x. If x is less than zero an error is signalled. The floating point precision of the result is given by the precision of x.

See also

tan Generic function
Summary

Returns the tangent of its argument.

Signature

tan x => y

Parameters
  • x – An instance of type <real>. The angle, in radians.

Values
  • y – An instance of type <float>.

Discussion

Returns the tangent of its argument. The floating point precision of the result is given by the precision of x.

See also

tanh Generic function
Summary

Returns the hyperbolic tangent of its argument.

Signature

tanh x => y

Parameters
  • x – An instance of type <real>. The angle, in radians.

  • y – An instance of type <float>.

Discussion

Returns the hyperbolic tangent of its argument. The floating point precision of the result is given by the precision of x.

See also