Standard arithmetic functions including things like rounding, sign manipulation, and maximum/minimum functions. Phase folding operations, and a convenient form of the modulus operation on which they are based, are also provided.
roundUp( x )
x
(floating point): a value.
x
rounded up
roundDown( x )
x
(floating point): a value
x
rounded down
round( x )
x
(floating point): a floating point value.
x
rounded to the nearest integer
roundDecimal( x, dp )
float
(32-bit floating point value),
so this is only suitable for relatively low-precision values.
It's intended for truncating the number of apparent significant
figures represented by a value which you know has been obtained
by combining other values of limited precision.
For more control, see the functions in the Formats
class.
x
(floating point): a floating point value
dp
(integer): number of decimal places (digits after the decimal point)
to retain
x
but with a
limited apparent precision
abs( x )
x
(integer): the argument whose absolute value is to be determined
abs( x )
x
(floating point): the argument whose absolute value is to be determined
max( a, b )
Multiple-argument maximum functions are also provided in the
Arrays
and Lists
packages.
a
(integer): an argument.
b
(integer): another argument.
a
and b
.
maxNaN( a, b )
a
(floating point): an argument.
b
(floating point): another argument.
a
and b
.
maxReal( a, b )
Multiple-argument maximum functions are also provided in the
Arrays
and Lists
packages.
a
(floating point): an argument
b
(floating point): another argument
a
and b
min( a, b )
Multiple-argument minimum functions are also provided in the
Arrays
and Lists
packages.
a
(integer): an argument.
b
(integer): another argument.
a
and b
.
minNaN( a, b )
a
(floating point): an argument.
b
(floating point): another argument.
a
and b
.
minReal( a, b )
Multiple-argument minimum functions are also provided in the
Arrays
and Lists
packages.
a
(floating point): an argument
b
(floating point): another argument
a
and b
mod( a, b )
a/b
.
This is a modulo operation, but differs from the expression
a%b
in that the answer is always >=0
(as long as b
is not zero).
a
(floating point): dividend
b
(floating point): divisor
a
by b
phase( t, period )
For positive period, the returned value is in the range [0,1).
t
(floating point): value
period
(floating point): folding period
phase( t, period, t0 )
t0
corresponds to phase zero.
For positive period, the returned value is in the range [0,1).
t
(floating point): value
period
(floating point): folding period
t0
(floating point): reference value, corresponding to phase zero
phase( t, period, t0, phase0 )
t0
corresponds to integer phase
value, and the phase offset phase0
determines the
starting value for the phase range.
For positive period, the returned value is in the range
[phase0
,phase0+1
).
t
(floating point): value
period
(floating point): folding period
t0
(floating point): reference value, corresponding to phase zero
phase0
(floating point): offset for phase