FloatingPointSystem

sf.spad line 78 [edit on github]

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. (actual implementations are usually binary or decimal) 2: precision of the mantissa (arbitrary or fixed) 3: rounding error for operations 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.

* : (%, %) -> %
from Magma
* : (%, Fraction(Integer)) -> %
from RightModule(Fraction(Integer))
* : (Fraction(Integer), %) -> %
from LeftModule(Fraction(Integer))
* : (Integer, %) -> %
from AbelianGroup
* : (NonNegativeInteger, %) -> %
from AbelianMonoid
* : (PositiveInteger, %) -> %
from AbelianSemiGroup
+ : (%, %) -> %
from AbelianSemiGroup
- : % -> %
from AbelianGroup
- : (%, %) -> %
from AbelianGroup
/ : (%, %) -> %
from Field
/ : (%, Integer) -> %

x / i computes the division from x by an integer i.

0 : () -> %
from AbelianMonoid
1 : () -> %
from MagmaWithUnit
< : (%, %) -> Boolean
from PartialOrder
<= : (%, %) -> Boolean
from PartialOrder
= : (%, %) -> Boolean
from BasicType
> : (%, %) -> Boolean
from PartialOrder
>= : (%, %) -> Boolean
from PartialOrder
^ : (%, Fraction(Integer)) -> %
from RadicalCategory
^ : (%, Integer) -> %
from DivisionRing
^ : (%, NonNegativeInteger) -> %
from MagmaWithUnit
^ : (%, PositiveInteger) -> %
from Magma
abs : % -> %
from OrderedRing
annihilate? : (%, %) -> Boolean
from Rng
antiCommutator : (%, %) -> %
from NonAssociativeSemiRng
associates? : (%, %) -> Boolean
from EntireRing
associator : (%, %, %) -> %
from NonAssociativeRng
base : () -> PositiveInteger

base() returns the base of the exponent.

bits : () -> PositiveInteger

bits() returns ceiling's precision in bits.

bits : PositiveInteger -> PositiveInteger if % has arbitraryPrecision

bits(n) set the precision to n bits.

ceiling : % -> %
from RealNumberSystem
characteristic : () -> NonNegativeInteger
from NonAssociativeRing
coerce : % -> %
from Algebra(%)
coerce : Fraction(Integer) -> %
from Algebra(Fraction(Integer))
coerce : Integer -> %
from NonAssociativeRing
coerce : % -> OutputForm
from CoercibleTo(OutputForm)
commutator : (%, %) -> %
from NonAssociativeRng
convert : % -> DoubleFloat
from ConvertibleTo(DoubleFloat)
convert : % -> Float
from ConvertibleTo(Float)
convert : % -> Pattern(Float)
from ConvertibleTo(Pattern(Float))
convert : % -> String
from ConvertibleTo(String)
decreasePrecision : Integer -> PositiveInteger if % has arbitraryPrecision

decreasePrecision(n) decreases the current precision precision by n decimal digits.

digits : () -> PositiveInteger

digits() returns ceiling's precision in decimal digits.

digits : PositiveInteger -> PositiveInteger if % has arbitraryPrecision

digits(d) set the precision to d digits.

divide : (%, %) -> Record(quotient : %, remainder : %)
from EuclideanDomain
euclideanSize : % -> NonNegativeInteger
from EuclideanDomain
exponent : % -> Integer

exponent(x) returns the exponent part of x.

expressIdealMember : (List(%), %) -> Union(List(%), "failed")
from PrincipalIdealDomain
exquo : (%, %) -> Union(%, "failed")
from EntireRing
extendedEuclidean : (%, %) -> Record(coef1 : %, coef2 : %, generator : %)
from EuclideanDomain
extendedEuclidean : (%, %, %) -> Union(Record(coef1 : %, coef2 : %), "failed")
from EuclideanDomain
factor : % -> Factored(%)
from UniqueFactorizationDomain
float : (Integer, Integer) -> %

float(a, e) returns a * base() ^ e.

float : (Integer, Integer, PositiveInteger) -> %

float(a, e, b) returns a * b ^ e.

floor : % -> %
from RealNumberSystem
fractionPart : % -> %
from RealNumberSystem
gcd : (%, %) -> %
from GcdDomain
gcd : List(%) -> %
from GcdDomain
gcdPolynomial : (SparseUnivariatePolynomial(%), SparseUnivariatePolynomial(%)) -> SparseUnivariatePolynomial(%)
from GcdDomain
increasePrecision : Integer -> PositiveInteger if % has arbitraryPrecision

increasePrecision(n) increases the current precision by n decimal digits.

inv : % -> %
from DivisionRing
latex : % -> String
from SetCategory
lcm : (%, %) -> %
from GcdDomain
lcm : List(%) -> %
from GcdDomain
lcmCoef : (%, %) -> Record(llcm_res : %, coeff1 : %, coeff2 : %)
from LeftOreRing
leftPower : (%, NonNegativeInteger) -> %
from MagmaWithUnit
leftPower : (%, PositiveInteger) -> %
from Magma
leftRecip : % -> Union(%, "failed")
from MagmaWithUnit
mantissa : % -> Integer

mantissa(x) returns the mantissa part of x.

max : () -> % if % hasn't arbitraryExponent and % hasn't arbitraryPrecision

max() returns the maximum floating point number.

max : (%, %) -> %
from OrderedSet
min : () -> % if % hasn't arbitraryExponent and % hasn't arbitraryPrecision

min() returns the minimum floating point number.

min : (%, %) -> %
from OrderedSet
multiEuclidean : (List(%), %) -> Union(List(%), "failed")
from EuclideanDomain
negative? : % -> Boolean
from OrderedRing
norm : % -> %
from RealNumberSystem
nthRoot : (%, Integer) -> %
from RadicalCategory
one? : % -> Boolean
from MagmaWithUnit
opposite? : (%, %) -> Boolean
from AbelianMonoid
order : % -> Integer

order x is the order of magnitude of x. Note: base ^ order x <= |x| < base ^ (1 + order x).

patternMatch : (%, Pattern(Float), PatternMatchResult(Float, %)) -> PatternMatchResult(Float, %)
from PatternMatchable(Float)
plenaryPower : (%, PositiveInteger) -> %
from NonAssociativeAlgebra(%)
positive? : % -> Boolean
from OrderedRing
precision : () -> PositiveInteger

precision() returns the precision in digits base.

precision : PositiveInteger -> PositiveInteger if % has arbitraryPrecision

precision(n) set the precision in the base to n decimal digits.

prime? : % -> Boolean
from UniqueFactorizationDomain
principalIdeal : List(%) -> Record(coef : List(%), generator : %)
from PrincipalIdealDomain
quo : (%, %) -> %
from EuclideanDomain
recip : % -> Union(%, "failed")
from MagmaWithUnit
rem : (%, %) -> %
from EuclideanDomain
retract : % -> Fraction(Integer)
from RetractableTo(Fraction(Integer))
retract : % -> Integer
from RetractableTo(Integer)
retractIfCan : % -> Union(Fraction(Integer), "failed")
from RetractableTo(Fraction(Integer))
retractIfCan : % -> Union(Integer, "failed")
from RetractableTo(Integer)
rightPower : (%, NonNegativeInteger) -> %
from MagmaWithUnit
rightPower : (%, PositiveInteger) -> %
from Magma
rightRecip : % -> Union(%, "failed")
from MagmaWithUnit
round : % -> %
from RealNumberSystem
sample : () -> %
from AbelianMonoid
sign : % -> Integer
from OrderedRing
sizeLess? : (%, %) -> Boolean
from EuclideanDomain
smaller? : (%, %) -> Boolean
from Comparable
sqrt : % -> %
from RadicalCategory
squareFree : % -> Factored(%)
from UniqueFactorizationDomain
squareFreePart : % -> %
from UniqueFactorizationDomain
subtractIfCan : (%, %) -> Union(%, "failed")
from CancellationAbelianMonoid
toString : % -> String

toString(x) returns the string representation of x.

toString : (%, NonNegativeInteger) -> String

toString(x, n) returns a string representation of x truncated to n decimal digits.

truncate : % -> %
from RealNumberSystem
unit? : % -> Boolean
from EntireRing
unitCanonical : % -> %
from EntireRing
unitNormal : % -> Record(unit : %, canonical : %, associate : %)
from EntireRing
wholePart : % -> Integer
from RealNumberSystem
zero? : % -> Boolean
from AbelianMonoid
~= : (%, %) -> Boolean
from BasicType

Module(Fraction(Integer))

ConvertibleTo(Float)

PrincipalIdealDomain

NonAssociativeSemiRing

BiModule(%, %)

Field

canonicalUnitNormal

Rng

CoercibleFrom(Integer)

TwoSidedRecip

EntireRing

PatternMatchable(Float)

NonAssociativeAlgebra(Fraction(Integer))

unitsKnown

RadicalCategory

CoercibleTo(OutputForm)

noZeroDivisors

RetractableTo(Fraction(Integer))

OrderedSet

Magma

SemiGroup

RightModule(Fraction(Integer))

GcdDomain

LeftModule(%)

NonAssociativeRing

UniqueFactorizationDomain

CharacteristicZero

Algebra(%)

CommutativeRing

OrderedAbelianMonoid

DivisionRing

canonicalsClosed

PartialOrder

NonAssociativeSemiRng

CancellationAbelianMonoid

EuclideanDomain

Approximate

Comparable

RetractableTo(Integer)

OrderedCancellationAbelianMonoid

OrderedRing

RealNumberSystem

SemiRing

CommutativeStar

AbelianMonoid

MagmaWithUnit

RightModule(%)

RealConstant

ConvertibleTo(String)

ConvertibleTo(DoubleFloat)

OrderedAbelianSemiGroup

Module(%)

ConvertibleTo(Pattern(Float))

BiModule(Fraction(Integer), Fraction(Integer))

SemiRng

Monoid

LeftOreRing

NonAssociativeAlgebra(%)

Algebra(Fraction(Integer))

BasicType

Ring

AbelianSemiGroup

IntegralDomain

SetCategory

CoercibleFrom(Fraction(Integer))

NonAssociativeRng

OrderedAbelianGroup

AbelianGroup

LeftModule(Fraction(Integer))