aboutsummaryrefslogtreecommitdiff
path: root/pkg/language/doc/mathfcns.hlp
blob: 50e797f390e95fe3c09cf2e6b5b6c08a0f77eb0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
.help mathfcns Feb86 language
.ih
NAME
mathfcns -- math functions available in the CL
.ih
SYNOPSIS

.nf
Function    Return value		  Description

sin(x)		real			sine
cos(x)		real			cosine
tan(x)		real			tangent
atan2(x,y)	real			arc-tangent
exp(x)		real			e**x
log(x)		real			natural logarithm
log10(x)	real			common logarithm
frac(x)		real			fractional part
abs(x)		type of argument	absolute value
min(a,b,...)	type of min. arg	minimum of a list of values
max(a,b,...)	type of max. arg	maximum of a list of values
real(x)		real			convert to real
int(x)		integer			integer part
.fi
.ih
DESCRIPTION
A number of mathematical functions are available under the CL.  In general
they return real values and may be used wherever a real expression is
valid.  The input arguments may be integer or real and may be mixed in
cases where the function has more than one argument.
Exceptions:

.nf
    abs(x) 	returns real or integer depending on its argument
    int(x)	returns an integer
    min,max	return a copy of the min/max operand, no type change
.fi

Note that the intrinsic functions \fIint\fR and \fIreal\fR may be called
to decode string valued arguments.
.ih
EXAMPLES
.nf
y = sin (x)
  = 180 / 3.1415927 * atan2 (x, y)
i = int (max (4.3, x, y, 2))
  = 1. - (sin(.5)**2 + cos(.5)**2)
.fi
.ih
BUGS
An invalid argument list to a math function (e.g. log(-1)) will terminate
a script.
.ih
SEE ALSO
strings
.endhelp