|
Section 6: Functions79
|
|
To compute the absolute value of +3:
|
|
|
|
Integer Portion of a Number
|
|
To extract and display the integer portion of a number, execute
INT (integer). For example, to extract
only the integer portion of the number 123.4567:
|
|
|
|
When INT is executed, the fractional portion of the
number is lost. The entire number, of course is preserved in the LAST X
register.
|
|
Fractional Portion of a Number
|
|
To extract and display only the fractional portion of a number, execute
FRC (fraction). For example, to extract
only the fractional portion of the number 123.4567 used above:
|
|
|
|
When FRC is executed, the integer portion of the
number is lost. The entire number is again preserved in the LAST X
register.
|
|
The Modulo Function (Remainder)
|
|
Executing MOD (modulo) performs y mod x
(the equation is y – [<y/x>×x], where <> denotes
the largest integer less than or equal to the indicated result), which
divides y by x and gives the remainder of the division. So, when you place
numbers in the X- and
|