Model DMM7510 7½ Digit Graphical Sampling Multimeter Reference Manual
Section 7: Introduction to TSP commands
DMM7510-901-01 Rev. B / May 2015
7-29
Math library functions
This library is an interface to most of the functions of the ANSI C math library. All trigonometric
functions work in radians. The functions
math.deg()
and
math.rad()
convert between radians
and degrees.
Math library functions
Function
Description
math.abs(
x
)
Returns the absolute value of
x
.
math.acos(
x
)
Returns the arc cosine of
x
.
math.asin(
x
)
Returns the arc sine of
x
.
math.atan(
x
)
Returns the arc tangent of
x
.
math.atan2(
y, x
)
Returns the arc tangent of
y
/
x
, but uses the signs of both parameters to
find the quadrant of the result (it also handles correctly the case of
x
being zero).
math.ceil(
x
)
Returns the smallest integer larger than or equal to
x
.
math.cos(
x
)
Returns the cosine of
x
.
math.deg(
x
)
Returns the angle
x
(given in radians) in degrees.
math.exp(
x
)
Returns the value
e
x
.
math.floor(
x
)
Returns the largest integer smaller than or equal to
x
.
math.frexp(
x
)
Returns
m
and
e
such that
x
= m2
e
, where
e
is an integer and the
absolute value of
m
is in the range
[0.5, 1]
(or zero when
x
is zero).
math.ldexp(
m, e
)
Returns
m2
e
(
e
should be an integer).
math.log(
x
)
Returns the natural logarithm of
x
.
math.log10(
x
)
Returns the base-10 logarithm of
x
.
math.max(
x, ...
)
Returns the maximum value among its arguments.
math.min(
x, ...
)
Returns the minimum value among its arguments.
math.pi
The value of
π
(3.141592654).
math.pow(
x, y
)
Returns
x
y
(you can also use the expression
x
^
y
to compute this value).
math.rad(
x
)
Returns the angle
x
(given in degrees) in radians.
math.random()
math.random(
m
)
math.random(
m, n
)
This function is an interface to the simple pseudorandom generator
function
rand
provided by ANSI C.
When called without arguments, returns a uniform pseudorandom real
number in the range
[0,1]
. When called with an integer number
m
,
math.random()
returns a uniform pseudorandom integer in the
range
[1,
m
]
. When called with two integer numbers
m
and
n
,
math.random()
returns a uniform pseudorandom integer in the
range
[
m, n
]
.
math.randomseed(
x
)
Sets
x
as the seed for the pseudorandom generator: equal seeds
produce equal sequences of numbers.
math.sin(
x
)
Returns the sine of
x
.
math.sqrt(
x
)
Returns the square root of
x
. (You can also use the expression
x
^0.5
to
compute this value.)
math.tan(
x
)
Returns the tangent of
x
.