immutable class RAT < $RATIONAL{RAT}, $NIL, $OPTION, $ANCHORED_FMT
****

________This_class_implements_rational_numbers_as_a_numerator_and_denominator
___which_are_'infinite'_precision_integers._____Numbers_are_held_in
___normalised_form_such_that
_____num.gcd(denom)_=_1_AND_denom_>_0


Ancestors
$ANCHORED_FMT $FMT $STR $OPTION
$NIL $IS_NIL $RATIONAL{_} $SIGNED{_}
$VALUE_ITERS{_} $LOG_OPS{_} $HASH $IS_EQ
$CONVERSION{_} $ROUNDING{_} $ARITHMETIC{_} $ADD_OPS{_}
$ZERO{_} $NFE{_} $TEXT $BINARY
$ORDERED{_} $IS_LT{_} $VALUE{_}



Public


Readable Attributes
attr denom :INTI;
attr num:INTI;

Constants
const is_limited : BOOL := false ;
const is_signed : BOOL := true ;
const negatable : BOOL := true ;

Features
abs : SAME
binstr : BINSTR
build(cursor : BIN_CURSOR) : SAME
build( .. Included as build
card : CARD
ceiling : SAME
create(str : BINSTR) : SAME .. Included as create
create(val : CARD) : SAME
****
__This_routine_creates_a_rational_number_which_has_the_same_value_as_the_argument.
create(numerator, denominator : CARD) : SAME
**** This routine creates a rational number which has the same value as
___the_result_of_dividing_the_numerator_by_the_denominator.
create(val : FIELD) : SAME
****
__This_routine_creates_a_rational_number_which_has_the_same_value_as_the_argument.
create(val : FLT) : SAME
****
__This_creation_routine_creates_a_rational_number_with_the_same_value_as_the_given_argument.
create(val : FLTD) : SAME
****
__This_creation_routine_creates_a_rational_number_with_the_same_value
___as_the_given_argument.
create(val : INT) : SAME
****
__This_routine_creates_a_rational_number_which_has_the_same_value_as_the_argument.
create(numerator, denominator : INT) : SAME
****
__This_routine_creates_a_rational_number_which_has_the_same_value_as
___the_result_of_dividing_the_numerator_by_the_denominator.
create(val : INTI) : SAME
****
__This_routine_creates_a_rational_number_which_has_the_same_value_as_the_argument.
create( numerator, denominator : INTI) : SAME
**** This routine creates a rational number which has the same value as
___the_result_of_dividing_the_numerator_by_the_denominator.
create(val : RAT) : SAME
****
__This_routine_creates_a_rational_number_which_has_the_same_value_as
___the_argument_-_merely_returning_the_argument.
create( .. Included as create
cube : SAME
div(other : SAME) : SAME
divmod(other, out quotient, out residue: SAME)
exp : SAME
field : FIELD
floor : SAME
flt : FLT
flt_str( .. Included as flt_str
fltd : FLTD
fmt( .. Included as fmt
fmt( .. Included as fmt
hash : CARD
****
in_range(lower,upper : SAME) : BOOL
****
__This_predicate_returns_true_if_and_only_if_self_has_a_value_between
___lower_and_upper_inclusive.
in_range(rng : $RANGE{RAT} ) : BOOL
****
__This_predicate_returns_true_if_and_only_if_self_has_a_value_within
___the_given_range.
in_tolerance(tolerance, val : SAME) : BOOL
**** This predicate returns true if and only if self is within the given
___tolerance_of_val.
int : INT
inti : INTI
inverse:SAME
is_card : BOOL
****
__This_predicate_returns_true_if_and_only_if_self_is_a_non-negative
___exact_number_in_the_range_of_the_class_CARD.
is_eq(other : SAME) : BOOL
****
__This_predicate_returns_true_if_and_only_if_self_and_other_are_the_same_value.
is_eq(other : $OB) : BOOL .. Included as is_eq
**** This is the generic equality predicate. c.f. the class $IS_EQ
is_exact : BOOL
****
__This_predicate_returns_true_if_and_only_if_self_is_an_exact(integer)_number.
is_int : BOOL
****
__This_predicate_returns_true_if_and_only_if_self_is_an_exact_number
___in_the_range_of_the_class_INT.
is_inti : BOOL
****
__This_predicate_returns_true_if_and_only_if_self_is_an_exact_number
___in_the_range_of_the_class_INT.
is_lt(other : SAME) : BOOL
****
__This_predicate_returns_true_if_and_only_if_self_is_less_than_other.
is_neg : BOOL
****
__This_predicate_returns_true_if_and_only_if_self_is_less_than_zero.
is_nil : BOOL
****
__This_predicate_returns_true_if_and_only_if_self_has_the_value_nil.
is_non_neg : BOOL
is_non_pos : BOOL
is_non_zero : BOOL
is_pos : BOOL
****
__This_predicate_returns_true_if_and_only_if_self_is_greater_than_zero.
is_rat( .. Included as is_rat
is_zero : BOOL
**** This predicate returns true if and only if self is zero.
log : SAME
max(other : SAME ) : SAME
min(other : SAME) : SAME
minus(other : SAME ) : SAME
mod(other : SAME) : SAME
negate : SAME
nil : SAME
****
__This_routine_returns_a_nil_value_which_may_not_be_used_in_arithmetic.
one : SAME
****
__This_routine_returns_a_'constant'_value_of_1.
plus(other : SAME ) : SAME
pow(x : CARD) : SAME
pow(x : INT) : SAME
pow(x:INTI):SAME
****
__This_routine_returns_the_result_of_raising_self_to_the_power_exp.
pow(exp : SAME) : SAME
****
__This_routine_returns_the_result_of_raising_self_to_the_power_exp.
rat : SAME
read(index : BIN_CURSOR) : SAME .. Included as read
round : SAME
sgn:SAME
****
__1/0/-1
sign : NUM_SIGNS
sqrt : SAME
square : SAME
str( .. Included as str
str : STR .. Included as str
times(other : SAME) : SAME
truncate : SAME
two : SAME
****
__This_routine_returns_a_'constant'_value_of_2.
write(fyle : BIN_FILE) .. Included as write
zero : SAME
****
__This_routine_returns_a_'constant'_value_of_0.

Iters
product!(val : SAME) : SAME
sum!(val : SAME) : SAME


Private

attr denom :INTI;
float( .. Included as float
attr num:INTI;
scan( .. Included as scan

The Sather Home Page