Skip to main content

FixedFloat

Struct FixedFloat 

Source
pub struct FixedFloat { /* private fields */ }
Expand description

A floating-point value carrying a fixed working precision and rounding mode.

Implementations§

Source§

impl FixedFloat

Source

pub fn from_float(value: Float, mode: RoundingMode) -> FixedFloat

Wraps a Float, adopting its precision and the given rounding mode.

Source

pub fn from_int(n: &Int, precision: u64, mode: RoundingMode) -> FixedFloat

Builds from an integer at precision bits.

Source

pub fn from_f64(x: f64, precision: u64, mode: RoundingMode) -> FixedFloat

Builds from an f64 at precision bits.

Source

pub fn zero(precision: u64, mode: RoundingMode) -> FixedFloat

Positive zero at precision bits.

Source

pub fn nan(precision: u64, mode: RoundingMode) -> FixedFloat

NaN / ±∞ at precision bits.

Source

pub fn infinity(precision: u64, mode: RoundingMode) -> FixedFloat

Positive infinity at precision bits.

Source

pub fn neg_infinity(precision: u64, mode: RoundingMode) -> FixedFloat

Negative infinity at precision bits.

Source

pub fn pi(precision: u64, mode: RoundingMode) -> FixedFloat

π at precision bits.

Source

pub fn e(precision: u64, mode: RoundingMode) -> FixedFloat

Euler’s number e at precision bits.

Source

pub fn precision(&self) -> u64

Returns the working precision in bits.

Source

pub fn rounding_mode(&self) -> RoundingMode

Returns the rounding mode.

Source

pub fn as_float(&self) -> &Float

Returns the underlying Float.

Source

pub fn into_float(self) -> Float

Consumes into the underlying Float.

Source

pub fn to_f64(&self) -> f64

Returns the value as the nearest f64.

Source

pub fn to_shortest_string(&self) -> String

Returns the shortest round-tripping decimal string.

Source

pub fn is_nan(&self) -> bool

Returns true if this value is NaN.

Source

pub fn is_infinite(&self) -> bool

Returns true if this value is ±∞.

Source

pub fn is_finite(&self) -> bool

Returns true if this value is finite.

Source

pub fn is_zero(&self) -> bool

Returns true if this value is ±0.

Source

pub fn sign(&self) -> Sign

Returns the sign of this value.

Source

pub fn with_precision(&self, precision: u64) -> FixedFloat

Re-rounds to a different precision (keeping the rounding mode).

Source

pub fn neg(&self) -> FixedFloat

Returns -self.

Source

pub fn abs(&self) -> FixedFloat

Returns |self|.

Source

pub fn sqrt(&self) -> FixedFloat

Returns √self.

Source

pub fn exp(&self) -> FixedFloat

Returns e^self.

Source

pub fn ln(&self) -> FixedFloat

Returns ln(self).

Source

pub fn sin(&self) -> FixedFloat

Returns sin(self).

Source

pub fn cos(&self) -> FixedFloat

Returns cos(self).

Source

pub fn tan(&self) -> FixedFloat

Returns tan(self).

Source

pub fn atan(&self) -> FixedFloat

Returns atan(self).

Source

pub fn pow(&self, exp: &FixedFloat) -> FixedFloat

Returns self raised to the floating power exp.

Trait Implementations§

Source§

impl Add for FixedFloat

Source§

type Output = FixedFloat

The resulting type after applying the + operator.
Source§

fn add(self, rhs: FixedFloat) -> FixedFloat

Performs the + operation. Read more
Source§

impl Add<&FixedFloat> for &FixedFloat

Source§

type Output = FixedFloat

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &FixedFloat) -> FixedFloat

Performs the + operation. Read more
Source§

impl AddAssign for FixedFloat

Source§

fn add_assign(&mut self, rhs: FixedFloat)

Performs the += operation. Read more
Source§

impl Clone for FixedFloat

Source§

fn clone(&self) -> FixedFloat

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for FixedFloat

Source§

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

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

impl Display for FixedFloat

Source§

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

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

impl Div for FixedFloat

Source§

type Output = FixedFloat

The resulting type after applying the / operator.
Source§

fn div(self, rhs: FixedFloat) -> FixedFloat

Performs the / operation. Read more
Source§

impl Div<&FixedFloat> for &FixedFloat

Source§

type Output = FixedFloat

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &FixedFloat) -> FixedFloat

Performs the / operation. Read more
Source§

impl DivAssign for FixedFloat

Source§

fn div_assign(&mut self, rhs: FixedFloat)

Performs the /= operation. Read more
Source§

impl Mul for FixedFloat

Source§

type Output = FixedFloat

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: FixedFloat) -> FixedFloat

Performs the * operation. Read more
Source§

impl Mul<&FixedFloat> for &FixedFloat

Source§

type Output = FixedFloat

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &FixedFloat) -> FixedFloat

Performs the * operation. Read more
Source§

impl MulAssign for FixedFloat

Source§

fn mul_assign(&mut self, rhs: FixedFloat)

Performs the *= operation. Read more
Source§

impl Neg for FixedFloat

Source§

type Output = FixedFloat

The resulting type after applying the - operator.
Source§

fn neg(self) -> FixedFloat

Performs the unary - operation. Read more
Source§

impl PartialEq for FixedFloat

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for FixedFloat

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Sub for FixedFloat

Source§

type Output = FixedFloat

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: FixedFloat) -> FixedFloat

Performs the - operation. Read more
Source§

impl Sub<&FixedFloat> for &FixedFloat

Source§

type Output = FixedFloat

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &FixedFloat) -> FixedFloat

Performs the - operation. Read more
Source§

impl SubAssign for FixedFloat

Source§

fn sub_assign(&mut self, rhs: FixedFloat)

Performs the -= operation. Read more

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.