Amos Professional Manual  Contents  Index

Maths


Similarly, the MIN function returns the smaller value of two expressions. Expressions can consist of strings, integers or real numbers, but only compare like with like, as follows:

D> A=Min(99,1) : Print A
   Print Min("AMOS Professional","AMOS")

Values and signs
Any number can have one of three values: negative, positive or zero, and these are represented by the "sign" of a number.

SGN
function: return the sign of a number
sign=Sgn(value)
sign=Sgn(value#)

The SGN function returns a value representing the sign of a number. The three possible results are these:

-1 if the value is negative
 1 if the value is positive
 0 if the value is zero

ABS
function: return an absolute value
a=Abs(value)
a=Abs(value#)

This function is used to convert arguments into a positive number. ABS returns an absolute value of an integer or fractional number, paying no attention to whether that number is positive or negative, in other words, ignoring its sign.

For example:

D> Print Abs(-1),Abs(1)

Floating point numbers
Numbers that consist of many digits either side of a decimal point can often give very messy results in Basic programming. The movement of the decimal point slows down the processing, and levels of accuracy may be too great for your needs.

INT
function: convert floating point number into an integer
integer=Int(number#)

Back    Next
05.03.04