Skip to main content

Number

Enum Number 

Source
pub enum Number {
    Int(BigInt),
    Rat(Rational),
    Bool(bool),
    Nothing,
    Alg(Algebraic),
    Real(ExactReal),
    Hyper(HyperValue),
    Nat(NaturalValue),
    Ord(Ordinal),
    Dep(Box<DependsValue<Number>>),
    Conv(Box<Converging<Number>>),
}
Expand description

A number of the exact tower. See the module documentation.

Variants§

Implementations§

Source§

impl Number

Source

pub fn arith(op: Op, a: Number, b: Number) -> Result<Number, String>

a op b: the exact tower first, then integers and rationals, exact division exact.

Source

pub fn holds(rel: Rel, a: &Number, b: &Number) -> Result<bool, String>

a rel b, a Bool, or the refusal of an answer that depends on the residue or is provisional.

Trait Implementations§

Source§

impl Clone for Number

Source§

fn clone(&self) -> Number

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Coefficient for Number

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

fn of_rational(r: Rational) -> Self

Source§

fn add(&self, o: &Self) -> Result<Self, ExpansionError>

Source§

fn sub(&self, o: &Self) -> Result<Self, ExpansionError>

Source§

fn neg(&self) -> Result<Self, ExpansionError>

Source§

fn mul(&self, o: &Self) -> Result<Self, ExpansionError>

Source§

fn is_zero(&self) -> Result<bool, ExpansionError>

Whether the coefficient is zero; refused when that cannot be told.
Source§

fn recip(&self) -> Result<Self, ExpansionError>

Source§

fn sign(&self) -> Result<i32, ExpansionError>

−1, 0 or 1; refused when the sign cannot be told.
Source§

fn nth_root(&self, n: u32) -> Result<Self, ExpansionError>

The real n-th root, the nonnegative one for an even n.
Source§

fn exp(&self) -> Result<Self, ExpansionError>

exp, for an expansion’s exponential.
Source§

fn ln(&self) -> Result<Self, ExpansionError>

The natural logarithm of a positive coefficient, for an expansion’s logarithm.
Source§

impl Debug for Number

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl TowerValue for Number

Source§

fn exact(&self) -> Option<ExactRef<'_, Self>>

The value as one of the exact types, or None for any other value.
Source§

fn standard_rational(&self) -> Option<Rational>

An integer, rational, decimal or finite float as the rational it denotes exactly.
Source§

fn integer(&self) -> Option<BigInt>

An Int or big integer.
Source§

fn exact_rational(&self) -> Option<Rational>

An integer or a rational: a number held exactly, never a float or a decimal.
Source§

fn is_standard_number(&self) -> bool

An integer, rational, decimal or float: its own standard part.
Source§

fn text(&self) -> Option<&str>

A Text value’s characters.
Source§

fn type_name(&self) -> String

The value’s type as the language names it.
Source§

fn display_string(&self) -> String

How the value prints.
Source§

fn values_equal(&self, other: &Self) -> bool

The language’s equality on two values.
Source§

fn is_nothing(&self) -> bool

Whether the value is nothing.
Source§

fn from_rational(r: Rational) -> Self

A rational in its smallest form: an Int when it fits, a big integer, else a rational.
Source§

fn from_bigint(b: BigInt) -> Self

An integer in its smallest form.
Source§

fn boolean(b: bool) -> Self

Source§

fn nothing() -> Self

Source§

fn algebraic(a: Algebraic) -> Self

Source§

fn exact_real(x: ExactReal) -> Self

Source§

fn hyper(h: HyperValue) -> Self

Source§

fn natural(n: NaturalValue) -> Self

Source§

fn ordinal(o: Ordinal) -> Self

Source§

fn depends(d: DependsValue<Self>) -> Self

Source§

fn converging(c: Converging<Self>) -> Self

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.