Sather Home Page

Section 8.12.1.16:
$WHOLE_NUM

is_even : BOOL ; -- This feature returns true if and only if self is an even valued -- number (ie self mod 2 is zero). is_odd : BOOL ; -- This predicate returns true if and only if self is an odd valued -- number. is_prime : BOOL ; -- This feature returns true if and only if self is a prime number. is_prime_to( other : NTP ) : BOOL ; -- This feature returns true if and only if self is relatively prime -- to other. evenly_divides( other : NTP ) : BOOL ; -- This predicate returns true if and only if self is an exact divisor -- of other. ceiling( val : NTP ) : NTP ; -- This routine returns the smallest whole number value greater than -- or equal to self which is also a multiple of val. gcd( other : NTP ) : NTP ; -- This feature returns the greatest common divisor of self and other. -- The result is always positive such that `other.gcd(0) = other.abs'. extended_gcd( other : NTP, out self_factor, out i_factor : NTP ) : SAME ; -- This routine returns the result of applying the extended Euclidean -- algorithm (Geddes et al, p36) to self and other. lcm( other : NTP ) : NTP ; -- This feature returns the least common multiple of self and other. factorial : NTP ; -- This feature returns the factorial of self, providing that this is -- representable, otherwise nil.
Language Index Library Index Numeric Index
Comments or enquiries should be made to Keith Hopper.
Page last modified: Wednesday, 21 February 2001.
Produced with Amaya