The transcendentals Module¶
The transcendentals module, exported from the commondylan library, provides a set of generic functions for ANSI Clike 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 commondylan 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
 Values
y – An instance of type
<real>
.
 Discussion
Returns
b
raised to the powerx
. Ifb
is0
andx
is not positive, an error is signalled. Ifb
is negative andx
is not an integer, an error is signalled.If
b
andx
are both integers, the result is an integer. Ifx
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. Ifx
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. Ifx
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. Ifx
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
 Values
z – An instance of type
<float>
.
 Discussion
Returns the arc tangent of
x
divided byy
.x
may be zero ify
is not zero. The signs ofx
andy
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

$doublee
Constant¶  summary
The value of e, the base of natural logarithms, as a double precision floating point number.
 type
<doublefloat>
 superclasses
 description
The value of e, the base of natural logarithms, as a double precision floating point number.
 See also

$doublepi
Constant¶  Summary
The value of π as a double precision floating point number.
 Type
<doublefloat>
 Superclasses
 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 ofx
. See also

hypot
Generic function¶  Summary
Returns the Euclidian distance.
 Signature
hypot x, y => z
 Parameters
 Values
z – An instance of type
<number>
.
 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
x – An instance of type
<integer>
.
 Values
y – An instance of type
<integer>
.
 Discussion
Returns the integer square root of
x
, that is the greatest integer less than or equal to the exact positive square root ofx
. Ifx
<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 ofx
. See also

logn
Function¶  Summary
Returns the logarithm of its argument to the given base.
 Signature
logn x b => y
 Parameters
 Values
y – An instance of
<number>
.
 Discussion
Returns the logarithm of
x
to the baseb
. If x <= 0 <= 1, an error is signalled. The floating point precision of the result is given by the precision ofx
. See also

ilog2
Function¶  Summary
Returns the base two logarithm of its argument, truncated to an integer.
 Signature
ilog2 x => y
 Parameters
x – An instance of
<integer>
.
 Values
y – An instance of
<integer>
.
 Discussion
Returns the integer base two logarithm of
x
, that is the greatest integer less than or equal to the exact base two logarithm ofx
. See also

sin
Generic function¶

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
 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

$singlee
Constant¶

$singlepi
Constant¶  Summary
The value of π as a single precision floating point number.
 Type
<singlefloat>
 Superclasses
 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
 Discussion
Returns the hyperbolic tangent of its argument. The floating point precision of the result is given by the precision of
x
. See also