2.9.1 Math Functions
Function
Description
Example of usage
Result
abs(a)
Returns the absolute value of a
abs(-300)
300
acos(a)
Returns the arc cosine value of a in radian format
acos(0.5)
1.0472
asin(a)
Returns the arc sine value of a in radian format
asin(0.5)
0.5236
atan(a)
Returns the arctangent value of a in radian format
atan(0.5)
0.4636
atan2(a, b)
Returns the arctangent value of a triangle with a for the y length and b for the x length in radian format
atan2(2,1)
1.1071
cos(r)
Returns the cosine value of r in radian format
cos(3.1415)
-1
deg2rad(d)
Returns the radian value of d in degree format
deg2rad(-90)
-1.570796
dist(x, y)
Returns the Euclidean distance from the origin to the (x, y) coordinate
dist(3.5,10)
10.59481
max(a, b)
Returns the greater value between a and b
max(-1.23, -3)
-1.23
min(a, b)
Returns the lesser value between a and b
max(-1.23, -3)
-3
near(a, b [,e])
Returns 1 if the difference between the real number values a and b is less than or equal to e and returns 0 if the difference is larger than e
near(0.005, 0.0058)
near(0.005, 0.006)
near(0.005, 0.006, 0.1)
1
0
1
rad2deg(r)
Returns the degree value of r in radian format
rad2deg(1.570796)
90
sin(r)
Returns the sine value of r in radian format
sin(1.5*3.1415)
-1
sqr(a)
Returns the square root of a
sqr(16)
sqr(0)
4
0
tan(r)
Returns the tangent value of r in radian format
tan(3.141592/4)
0.9999
Last updated
Was this helpful?