/usr/share/axiom-20170501/src/algebra/FPS.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | )abbrev category FPS FloatingPointSystem
++ Description:
++ This category is intended as a model for floating point systems.
++ A floating point system is a model for the real numbers. In fact,
++ it is an approximation in the sense that not all real numbers are
++ exactly representable by floating point numbers.
++ A floating point system is characterized by the following:
++
++ 1: base of the exponent where the actual implemenations are
++ usually binary or decimal)\br
++ 2: precision of the mantissa (arbitrary or fixed)\br
++ 3: rounding error for operations
--++ 4: when, and what happens if exponent overflow/underflow occurs
++
++ Because a Float is an approximation to the real numbers, even though
++ it is defined to be a join of a Field and OrderedRing, some of
++ the attributes do not hold. In particular associative("+")
++ does not hold. Algorithms defined over a field need special
++ considerations when the field is a floating point system.
FloatingPointSystem() : Category == SIG where
SIG ==> RealNumberSystem() with
approximate
++\spad{approximate} means "is an approximation to the real numbers".
float : (Integer,Integer) -> %
++float(a,e) returns \spad{a * base() ** e}.
float : (Integer,Integer,PositiveInteger) -> %
++float(a,e,b) returns \spad{a * b ** e}.
order : % -> Integer
++order x is the order of magnitude of x.
++Note that \spad{base ** order x <= |x| < base ** (1 + order x)}.
base : () -> PositiveInteger
++base() returns the base of the
++\spadfunFrom{exponent}{FloatingPointSystem}.
exponent : % -> Integer
++ exponent(x) returns the
++ \spadfunFrom{exponent}{FloatingPointSystem} part of x.
mantissa : % -> Integer
++ mantissa(x) returns the mantissa part of x.
bits : () -> PositiveInteger
++ bits() returns ceiling's precision in bits.
digits : () -> PositiveInteger
++ digits() returns ceiling's precision in decimal digits.
precision : () -> PositiveInteger
++ precision() returns the precision in digits base.
if % has arbitraryPrecision then
bits : PositiveInteger -> PositiveInteger
++ bits(n) set the \spadfunFrom{precision}{FloatingPointSystem}
++ to n bits.
digits : PositiveInteger -> PositiveInteger
++ digits(d) set the \spadfunFrom{precision}{FloatingPointSystem}
++ to d digits.
precision : PositiveInteger -> PositiveInteger
++ precision(n) set the precision in the base to n decimal digits.
increasePrecision : Integer -> PositiveInteger
++ increasePrecision(n) increases the current
++ \spadfunFrom{precision}{FloatingPointSystem} by n decimal digits.
decreasePrecision : Integer -> PositiveInteger
++ decreasePrecision(n) decreases the current
++ \spadfunFrom{precision}{FloatingPointSystem} precision
++ by n decimal digits.
if not (% has arbitraryExponent) then
if not (% has arbitraryPrecision) then
min: () -> %
++ min() returns the minimum floating point number.
max: () -> %
++ max() returns the maximum floating point number.
add
float(ma, ex) == float(ma, ex, base())
digits() == max(1,4004 * (bits()-1) quo 13301)::PositiveInteger
|