immutable class FIELD < $CARDINAL{FIELD}, $OPTION, $EXACT_FMT
****

__This_immutable_class_is_one_of_the_most_fundamental_exact_number_classes.
__It_has_the_value_domain_from_0_to_some_maximum_value_determined
__by_the_machine_representation_provided.___All_arithmetic_on_values_of_this
__class_is_modular_in_the_field_zero_to_2^asize.__This_class_inherits_from
__AVAL{BIT}._The_number_of_bits_in_the_representation_is_identical_to
__NUM_BITS::Num_Bits.

___NOTE_The_Sather_language_requires_that_Num_Bits_be_at_least_32_to_ensure
________portability_of_INT_literals_up_to_this_size.

________No_operation_results_in_an_out_of_range_value_so_no_checking
___is_required.

___References_:
________Keith_O._Geddes,_Stephen_R._Czapor,_and_George_Labahn,_"Algorithms
________for_Computer_Algebra",_Kluwer_Academic_Publishers,_Boston,_1992.


Ancestors
$EXACT_FMT $FMT $STR $OPTION
$CARDINAL{_} $VALUE_ITERS{_} $LIMITED{_} $WHOLE_NUM{_}
$SIMPLE_NUM{_} $HASH $IS_EQ $SEQUENCERS{_}
$COUNTS{_} $ARITHMETIC{_} $ADD_OPS{_} $ZERO{_}
$NFE{_} $TEXT $BINARY $ORDERED{_}
$IS_LT{_} $VALUE{_} $NIL $IS_NIL
$CONVERSION{_}



Public


Constants
const Num_Bits : CARD := asize ; .. Included as Num_Bits
const is_exact : BOOL := true ; .. Included as is_exact
const is_limited : BOOL := true ; .. Included as is_limited
const is_signed : BOOL := false ; .. Included as is_signed
const one : SAME := 1 ; .. Included as one
const two : SAME := 2 ; .. Included as two
const zero : SAME := 0 ; .. Included as zero
**** See $NFE

Features
abs : SAME
aget( .. Included as aget
aset( .. Included as aset
binstr : BINSTR .. Included as binstr
build( .. Included as build
build( .. Included as build
build_based( .. Included as build_based
card : CARD
**** This routine returns a copy of self. Built-in to this implementation.
ceiling(other : SAME) : SAME .. Included as ceiling
create(str : BINSTR) : SAME .. Included as create
create(val : CARD) : SAME
create(val : FIELD) : SAME
create(val : FLT) : SAME .. Included as create
create(val : FLTD) : SAME .. Included as create
create(val : INT) : SAME .. Included as create
create(val : INTI) : SAME .. Included as create
create(val : QUADBITS) : SAME
**** This returns a field value from the given bit-pattern.
create(val : RAT) : SAME .. Included as create
create( .. Included as create
cube : SAME .. Included as cube
decimal_str( .. Included as decimal_str
decimal_str( .. Included as decimal_str
decimal_str( .. Included as decimal_str
decimal_str : STR .. Included as decimal_str
div(other : SAME) : SAME
evenly_divides(other : SAME) : BOOL .. Included as evenly_divides
**** This predicate returns true if and only if self is an exact divisor of other.
exp10 : SAME .. Included as exp10
exp2 : SAME .. Included as exp2
extended_gcd(other : SAME, out self_factor, out i_factor : SAME) : SAME .. Included as extended_gcd
factorial : SAME .. Included as factorial
field : SAME
**** This routine returns a copy of self. Built-in to this implementation.
flt : FLT .. Included as flt
fltd : FLTD .. Included as fltd
fmt( .. Included as fmt
fmt( .. Included as fmt
gcd(other : SAME) : SAME .. Included as gcd
hash : CARD .. Included as hash
****
in_range(lower, upper : SAME) : BOOL .. Included as in_range
**** This predicate returns true if and only if self has a value between
___lower_and_upper_inclusive.__Built-in_to_this_implementation.
in_range(rng : $RANGE{XTP}) : BOOL .. Included as in_range
**** This predicate returns true if and only if self has a value within
___the_given_range.
in_tolerance(tolerance, val : SAME) : BOOL .. Included as in_tolerance
**** This predicate returns true if and only if self is within the given
___tolerance_of_val.
int : INT
inti : INTI .. Included as inti
is_eq( .. Included as is_eq
is_eq(other : $OB) : BOOL .. Included as is_eq
**** This is the generic equality predicate. c.f. the class $IS_EQ
is_even : BOOL .. Included as is_even
**** This predicate returns true if and only if self is an even valued number.
is_exp2 : BOOL .. Included as is_exp2
**** This predicate returns true if and only if self is a power of two.
is_field(str : STR) : BOOL
****
__This_predicate_returns_true_if_and_only_if_str_represents_a_field_number.
is_hex( .. Included as is_hex
is_lt(other : SAME) : BOOL
**** This predicate returns true if and only if self is less than other
___using_the_closed_field_arithmetic_relation_(ie_the_value_with_all_bits_set
___is_less_than_the_next_value_which_has_all_bits_clear!).
is_nil : BOOL .. Included as is_nil
**** This predicate returns true if and only if self is nil.
is_octal( .. Included as is_octal
is_odd : BOOL .. Included as is_odd
****
__This_predicate_returns_true_if_and_only_if_self_is_an_odd_valued_number.
is_pos : BOOL .. Included as is_pos
**** This predicate returns true if and only if self is greater than zero.
is_prime : BOOL
**** This predicate returns true if and only if self is a prime number.
is_prime_to(other : SAME) : BOOL .. Included as is_prime_to
**** This predicate returns true if and only if self is relatively prime to other.
is_zero : BOOL .. Included as is_zero
**** This predicate returns true if and only if self is zero.
lcm(other : SAME) : SAME .. Included as lcm
log2 : SAME
max(other : SAME) : SAME .. Included as max
maxval : SAME .. Included as maxval
middle(first, second : SAME) : SAME .. Included as middle
min(other : SAME) : SAME .. Included as min
minus(other : SAME) : SAME
minval : SAME .. Included as minval
mod(other : SAME) : SAME
next_exp2 : SAME
nil : SAME .. Included as nil
**** This routine returns the value to be used to represent nil. This is the value maxval in this implementation.
num_chars : CARD .. Included as num_chars
plus(other : SAME) : SAME
pow(power : SAME) : SAME .. Included as pow
**** pre (power < (maxval / self)) post true -- better one??
rat : RAT .. Included as rat
read(index : BIN_CURSOR) : SAME .. Included as read
sign : NUM_SIGNS .. Included as sign
sqrt : SAME .. Included as sqrt
square : SAME .. Included as square
str( .. Included as str
str : STR .. Included as str
times(other : SAME) : SAME
write(fyle : BIN_FILE) .. Included as write

Iters
aelt!( .. Included as aelt!
aelt!( .. Included as aelt!
aelt!( .. Included as aelt!
aelt! : BOOL .. Included as aelt!
**** This iter is effectively a predicate which yields true or false
___depending_upon_whether_the_indicated_bit_of_self_was_set_or_not.
aind! : CARD .. Included as aind!
binary!(once limit : SAME) : SAME .. Included as binary!
downto!(once limit : SAME) : SAME .. Included as downto!
for!(once cnt : SAME) : SAME .. Included as for!
product!(other : SAME) : SAME .. Included as product!
step!(once cnt : CARD, once step : INT) : SAME .. Included as step!
stepto!(once to : SAME, once by : INT) : SAME .. Included as stepto!
sum!(other : SAME) : SAME .. Included as sum!
times! .. Included as times!
times! : SAME .. Included as times!
up! : SAME .. Included as up!
upto!(once limit : SAME) : SAME .. Included as upto!


Private

const Decimal_Base : CARD := 10 ; .. Included as Decimal_Base
const Default_Base : CARD := Decimal_Base ; .. Included as Default_Base
const Hexadecimal_Base : CARD := 16 ; .. Included as Hexadecimal_Base
const Max_Power : SAME := 19 ; .. Included as Max_Power
**** temporary fixed value
const Octal_Base : CARD := 8 ; .. Included as Octal_Base
const asize : CARD := NUM_BITS::Num_Bits ; .. Included as asize
do_build( .. Included as do_build
is_kind( .. Included as is_kind
is_legal_aelts_arg( .. Included as is_legal_aelts_arg
is_whole( .. Included as is_whole
scan( .. Included as scan
zero_filled( .. Included as zero_filled

The Sather Home Page