**** Rational numbers. A rational number is represented by by two integers u and v (numerator and denominator) and always normalized, i.e. u.gcd(v) = 1 and v > 0.

Flattened version is here

Ancestors
 \$STR \$IS_LT{_} \$IS_EQ

Public

 **** numerator, denominator
 **** numerator, denominator

Features
abs: SAME
ceiling: INTI
create (u: INT): SAME
create (u, v: INT): SAME
create (u: INTI): SAME
create (u, v: INTI): SAME
cube: SAME
div (y: SAME): SAME
 **** Returns the floating point number x = s * m * b^e that is closest to self. x is returned in form of a 4-tupel (s, m, e, a). n specifies the length of the mantissa m in no. of digits to the base b. The mantissa is either 0 (self = 0) or normalized, i.e. it holds: b^(n-1) <= mantissa < b^n. The sign s indicates a negative number. The flag a indicates that x is accurate (i.e. x = self). Rounding to the nearest is used; ties are broken by rounding to even (IEEE rounding). The implementation is essentialy AlgorithmM described by W.D. Clinger in "How to Read Floating Point Numbers Accurately", PLDI 1990 proceedings, p. 92-101.
floor: INTI
hash:INT
is_eq (y: SAME): BOOL
is_int: BOOL
is_lt (y: SAME): BOOL
is_neg: BOOL
is_pos: BOOL
is_zero: BOOL
minus (y: SAME): SAME
mod (y: SAME): SAME
negate: SAME
plus (y: SAME): SAME
 **** Returns self raised to the power i. Returns 1 for i < 0.
sign: INT
square: SAME
 **** Returns a string representation of self in decimal floating point form [sign] digit '.' {digit} ['e' [sign] digit {digit}] where n specifies the number of digits of the mantissa.
 **** Returns a string representation of self in the form u/v or u (if self.is_int).
times (y: SAME): SAME

Private

 **** numerator, denominator
 **** numerator, denominator