library(math)
library(math)
is an interface to the math(3m)
library.
All of the predicates in this module take some number of numeric
arguments and yield a numeric result as their last argument. For
example, the predicate call sin(
X,
Result)
unifies Result with sin(
X)
.
The predicates provided are
sign(
X,
Result)
sign(
X,
Y,
AbsX_SignY)
abs(
X,
Result)
fabs(
X,
Result)
hypot(
X,
Y,
Result)
sqrt(
X*
X+
Y*
Y)
max(
X,
Y,
Result)
min(
X,
Y,
Result)
log(
X,
Result)
log10(
X,
Result)
pow(
X,
Y,
Result)
exp(
Y,
Result)
sqrt(
X,
Result)
scale(
X,
Integer,
Result)
floor(
+X,
?Result)
floor(
+X,
Result,
Fraction)
ffloor(
X,
Result)
float(floor(
X))
ffloor(
X,
Result,
Fraction)
truncate(
X,
I)
truncate(
X,
I,
F)
ftruncate(
X,
I)
ftruncate(
X,
I,
F)
ceiling(
+X,
?Result)
ceiling(
+X,
?Result,
Fraction)
ceiling/2
, with a fraction present.
fceiling(
X,
Result)
float(ceiling(
X))
fceiling(
X,
Result,
Fraction)
fceiling/2
, with a fraction present.
round(
X,
Result)
round(
X,
Result,
Fraction)
fround(
X,
Result)
fround(
X,
Result,
Fraction)
fremainder(
X,
Y,
Remainder)
decode_float
(?Number, ?Sign, ?Significand, ?Exponent)
j0(
X,
Result)
y0(
X,
Result)
j0(3m)
j1(
X,
Result)
y1(
X,
Result)
jn(
N,
X,
Result)
yn(
N,
X,
Result)
sin(
X,
Result)
asin(
X,
Result)
sinh(
X,
Result)
asinh(
X,
Result)
cos(
X,
Result)
acos(
X,
Result)
cosh(
X,
Result)
acosh(
X,
Result)
tan(
X,
Result)
atan(
X,
Result)
atan2(
X,
Y,
Result)
tanh(
X,
Result)
atanh(
X,
Result)
gamma(
X,
Result)
ln(gamma(
X))
;
see NOTE #5, below.
Notes:
X+Y
is given mixed arguments,
it will convert the integer argument to a floating-point number. In this
release, max(
X,
Y,
Max)
and min(
X,
Y,
Min)
do not do this. For
example,
| ?- min(1, 2.3, X). X = 1
This is likely to change.
^(
X,
N,
Result)
exp(
Y,
Result)
exp(
X,
Y,
Result)
log(
X,
Y,
Result)
log(
Y,
Result)
gamma()
is in fact the natural
logarithm of the gamma function. It is not generally available on non-UNIX
versions of Quintus Prolog. It is retained in this release for
compatibility with previous releases.