Global math functions – BrightSign BrightScript 2 Reference Guide User Manual
Page 40

40
Global Math Functions
The following math functions are part of global. Trig functions use or return radians, not
degrees.
Abs (x As Float) As Float
Returns the absolute value of the argument.
Atn (x As Float) As Float
Returns the arctangent (in radians) of the argument; that is, ATN(X) returns "the angle
whose tangent is X". To get arctangent in degrees, multiply ATN(X) by 57.29578.
Cos (x As Float) As Float
Returns the cosine of the argument (argument must be in radians). To obtain the cosine of
X when X is in degrees, use CGS(X*.01745329).
Csng (x As Integer) As Float
Returns a single-precision float representation of the argument.
Cdbl(x As Integer) As Float
Also returns a single precision float representation of the argument. Someday may
return double.
Exp (x As Float) As Float
Returns the "natural exponential" of X, that is, ex. This is the inverse of the LOG
function, so X=EXP(LOG(X)).
Fix (x as Float) As Integer
Returns a truncated representation of the argument. All digits to the right of the decimal
point are simply chopped off, so the resultant value is an integer. For non-negative X,
FIX(X)=lNT(X). For negative values of X, FIX(X)=INT(X)+1. For example, FIX(2.2)
returns 2, and FIX(-2.2) returns -2.
Int(x As Float) As Integer
Returns an integer representation of the argument, using the largest whole number that is
not greater than the argument.. INT(2.5) returns 2; INT(-2.5) returns -3; and
INT(1000101.23) returns 10000101.
Log(x As Float) As Float
Returns the natural logarithm of the argument, that is, log
e
(argument ). This
is the inverse of the EXP function, so X=LOG(EXP (X)). To find the logarithm of a
number to another base b, use the formula log
b
(X) = log
e
(X)/log
e
(b). For example,
LOG(32767)/LOG(2) returns the logarithm to base 2 of 32767.