Log(x), Random, Rnd(x) – BrightSign HD2000 BrightScript Reference Guide User Manual

Page 28: Sgn(x), Sin(x), Sqr(x), Tan(x)

Advertising
background image

28

LOG(x)

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.

PRINT LOG(3.3*X)

RANDOM

is actually a complete statement rather than a function. It reseeds the random number generator. If a program
uses the RND function, you may want to put RANDOM at the beginning of the program. This will ensure that
you get an unpredictable sequence of pseudo-random numbers each time you run the program.

RANDOM
C=RND(6)

RND(x)

Generates a pseudo-random number using the current pseudo-random "seed number" (generated internally
and not accessible to user). RND may be used to produce random numbers between 0 and 1, or random
integers greater than 0, depending on the argument.

RND(0) returns a single-precision float value between 0 and 1.
RND(integer) returns an integer between 1 and integer inclusive . For example, RND(55) returns a
pseudo-random integer greater than zero and less than 56.

SGN(x)

The "sign" function: returns -1 for X negative, 0 for X zero, and +l for X positive.

SIN(x)

Returns the sine of the argument (argument must be in radians). To obtain the sine of X when X is in degrees,
use SIN(X*.01745329).

SQR(x)

Returns the square root of the argument. SQR(X) is the same as X^(1/2), only faster.

TAN(x)

Returns the tangent of the argument (argument must be in radians). To obtain the tangent of X when X is in
degrees, use TAN(X*.01745329).

ERL

Returns the line number in which an error has occurred. This function is primarily used inside an
error-handling routine accessed by an ON ERROR GOTO statement. If no error has occurred when ERL is
called, line number 0 is returned. However, if an error has occurred since power-up, ERL returns the line
number in which the error occurred.

Advertising
This manual is related to the following products: