Trait mexprp::num::Num [] [src]

pub trait Num: Debug + Display + Clone + PartialEq where
    Self: Sized
{ fn from_f64(t: f64, ctx: &Context<Self>) -> Calculation<Self>;
fn from_f64_complex(t: (f64, f64), ctx: &Context<Self>) -> Calculation<Self>;
fn typename() -> String; fn tryord(
        &self,
        other: &Self,
        ctx: &Context<Self>
    ) -> Result<Ordering, MathError> { ... }
fn add(&self, other: &Self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn sub(&self, other: &Self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn mul(&self, other: &Self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn div(&self, other: &Self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn pow(&self, other: &Self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn sqrt(&self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn nrt(&self, other: &Self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn abs(&self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn sin(&self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn cos(&self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn tan(&self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn asin(&self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn acos(&self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn atan(&self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn atan2(&self, other: &Self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn floor(&self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn ceil(&self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn round(&self, ctx: &Context<Self>) -> Calculation<Self> { ... }
fn log(&self, other: &Self, ctx: &Context<Self>) -> Calculation<Self> { ... } }

A Num represents any type that can be used in an expression. It requires lots of operations to be implemented for it, any of which can fail, as well as the traits: Debug, Clone, Display, PartialOrd, and PartialEq.

Required Methods

Attempts to create an instance of the number from an f64

Attempts to create an instance of the number from complex parts. It's possible the imaginary part will be ignored for Numbers that don't support it.

Returns the name of this Num type (used for errors)

Provided Methods

Implementations on Foreign Types

impl Num for Rational
[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

impl Num for Complex
[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

impl Num for f64
[src]

[src]

[src]

[src]

[src]

Compares two floats. Errors if either is NaN. Infinity is greater than anything except equal to infinity. Negative infinity is less than anything except equal to negative infinity.

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Implementors