checkinteger(ITEM, LOW_INT, HI_INT)
Checks ITEM to be an integer within the range specified by lower bound LOW_INT and upper bound HI_INT (inclusive). Either or both bounds may be <false> to indicate no upper or lower limit. If all conditions are satisfied the procedure returns with no action, otherwise a mishap occurs.
gcd_n(INT1, INT2, ..., INT_N, N) -> GCD
Computes the greatest common divisor of the all the N integers INT1, INT2, ..., INT_N, where the number N itself (a simple integer >= 0) appears as the rightmost argument. If N = 0, then GCD = 0; if N = 1, then GCD = INT1.
lcm_n(INT1, INT2, ..., INT_N, N) -> LCM
Computes the least common multiple of the all the N integers INT1, INT2, ..., INT_N, where the number N itself (a simple integer >= 0) appears as the rightmost argument. If N = 0, then LCM = 1; if N = 1, then LCM = INT1.
destratio(RAT) -> (NUMERATOR, DENOMINATOR)
numerator(RAT) -> NUMERATOR
denominator(RAT) -> DENOMINATOR
These procedures return (on the stack) the numerator and denominator
parts of a rational number, either together (-destratio-), or
separately (-numerator- and -denominator-). When RAT is an integer
or biginteger, then NUMERATOR = RAT, and DENOMINATOR = 1.
fracof(x) fractional part of a decimal number
intof(x) integer part of a decimal number, positive or negative
intof(-123.456), fracof(-123.456) =>
** -123 -0.456
float_digits(FLOAT) -> DIGITS
Returns an integer, the number of digits represented in the internal
(usually binary) floating-point format of the argument. (I.e. DIGITS
has only two possible values, one for decimals and one for
ddecimals. In all current Poplog implementations, b = 2 and DIGITS
is around 22 for decimals, 53-56 for ddecimals.) On a sparcstation:
float_digits(1.0e0), float_digits(1.0s0) =>
** 53 22
float_precision(FLOAT) -> SIGDIGITS
Same as -float_digits-, except that the number of significant bits
in the argument is returned. This will in fact be identical to
float_digits(FLOAT), except that float_precision(0.0) = 0
float_decode(FLOAT, INT_MANTISSA) -> (MANTISSA, INT_EXPO, FLOAT_SIGN)
This procedure takes a floating-point number and splits it into its
component parts, i.e. mantissa, exponent and sign. For full (gory)
details see REF NUMBERS
float_scale(FLOAT1, INT_EXPO) -> FLOAT2
This is equivalent to
FLOAT1 * 2**INT_EXPO
but is more efficient and avoids any intermediate overflow or
underflow. If the final result overflows or underflows (i.e. the
absolute value of the exponent is too large for the representation),
then <false> is returned. This procedure can be used in conjunction
with -float_sign- to put back together a floating-point number
decomposed with -float_decode-. That is, after
float_sign(FLOAT_SIGN, FLOAT1) -> FLOAT2
Returns a floating-point number FLOAT2 of the same type and absolute
value as FLOAT1, but which has the sign of the float FLOAT_SIGN. If
FLOAT1 is false> then FLOAT2 is returned as a 1.0 or -1.0 of the
same type and sign as FLOAT_SIGN.
For more details see REF NUMBERS