Struct noisy_float::NoisyFloat [] [src]

pub struct NoisyFloat<F: Float, C: FloatChecker<F>> {
    // some fields omitted
}

A floating point number with a restricted set of legal values.

Typical users will not need to access this struct directly, but can instead use the type aliases found in the module noisy_float::types. However, this struct together with a FloatChecker implementation can be used to define custom behavior.

The underlying float type is F, usually f32 or f64. Valid values for the float are determined by the float checker C. If an invalid value would ever be returned from a method on this type, the method will panic instead, using either assert! or debug_assert! as defined by the float checker. The exception to this rule is for methods that return an Option containing a NoisyFloat, in which case the result would be None if the value is invalid.

Methods

impl<F: Float, C: FloatChecker<F>> NoisyFloat<F, C>
[src]

Constructs a NoisyFloat with the given value.

Uses the FloatChecker to assert that the value is valid.

Tries to construct a NoisyFloat with the given value.

Returns None if the value is invalid.

Constructs a NoisyFloat with the given f32 value.

May panic not only by the FloatChecker but also by unwrapping the result of a NumCast invocation for type F, although the later should not occur in normal situations.

Constructs a NoisyFloat with the given f64 value.

May panic not only by the FloatChecker but also by unwrapping the result of a NumCast invocation for type F, although the later should not occur in normal situations.

Returns the underlying float value.

Trait Implementations

impl<F: Float, C: FloatChecker<F>> Clone for NoisyFloat<F, C>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<F: Float, C: FloatChecker<F>> Copy for NoisyFloat<F, C>
[src]

impl<F: Float, C: FloatChecker<F>> PartialEq for NoisyFloat<F, C>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<F: Float, C: FloatChecker<F>> Eq for NoisyFloat<F, C>
[src]

impl<F: Float, C: FloatChecker<F>> PartialOrd for NoisyFloat<F, C>
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<F: Float, C: FloatChecker<F>> Ord for NoisyFloat<F, C>
[src]

This method returns an Ordering between self and other. Read more

impl<F: Float, C: FloatChecker<F>> Add for NoisyFloat<F, C>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<F: Float, C: FloatChecker<F>> Sub for NoisyFloat<F, C>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<F: Float, C: FloatChecker<F>> Mul for NoisyFloat<F, C>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<F: Float, C: FloatChecker<F>> Div for NoisyFloat<F, C>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<F: Float, C: FloatChecker<F>> Rem for NoisyFloat<F, C>
[src]

The resulting type after applying the % operator

The method for the % operator

impl<F: Float + AddAssign, C: FloatChecker<F>> AddAssign for NoisyFloat<F, C>
[src]

The method for the += operator

impl<F: Float + SubAssign, C: FloatChecker<F>> SubAssign for NoisyFloat<F, C>
[src]

The method for the -= operator

impl<F: Float + MulAssign, C: FloatChecker<F>> MulAssign for NoisyFloat<F, C>
[src]

The method for the *= operator

impl<F: Float + DivAssign, C: FloatChecker<F>> DivAssign for NoisyFloat<F, C>
[src]

The method for the /= operator

impl<F: Float + RemAssign, C: FloatChecker<F>> RemAssign for NoisyFloat<F, C>
[src]

The method for the %= operator

impl<F: Float, C: FloatChecker<F>> Neg for NoisyFloat<F, C>
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl<F: Float, C: FloatChecker<F>> Zero for NoisyFloat<F, C>
[src]

Returns the additive identity element of Self, 0. Read more

Returns true if self is equal to the additive identity.

impl<F: Float, C: FloatChecker<F>> One for NoisyFloat<F, C>
[src]

Returns the multiplicative identity element of Self, 1. Read more

impl<F: Float, C: FloatChecker<F>> Num for NoisyFloat<F, C>
[src]

Convert from a string and radix <= 36.

impl<F: Float, C: FloatChecker<F>> ToPrimitive for NoisyFloat<F, C>
[src]

Converts the value of self to an i64.

Converts the value of self to an u64.

Converts the value of self to an isize.

Converts the value of self to an i8.

Converts the value of self to an i16.

Converts the value of self to an i32.

Converts the value of self to a usize.

Converts the value of self to an u8.

Converts the value of self to an u16.

Converts the value of self to an u32.

Converts the value of self to an f32.

Converts the value of self to an f64.

impl<F: Float, C: FloatChecker<F>> NumCast for NoisyFloat<F, C>
[src]

Creates a number from another value that can be converted into a primitive via the ToPrimitive trait. Read more

impl<F: Float, C: FloatChecker<F>> Float for NoisyFloat<F, C>
[src]

Returns the NaN value. Read more

Returns the infinite value. Read more

Returns the negative infinite value. Read more

Returns -0.0. Read more

Returns the smallest finite value that this type can represent. Read more

Returns the smallest positive, normalized value that this type can represent. Read more

Returns the largest finite value that this type can represent. Read more

Returns true if this value is NaN and false otherwise. Read more

Returns true if this value is positive infinity or negative infinity and false otherwise. Read more

Returns true if this number is neither infinite nor NaN. Read more

Returns true if the number is neither zero, infinite, [subnormal][subnormal], or NaN. Read more

Returns the floating point category of the number. If only one property is going to be tested, it is generally faster to use the specific predicate instead. Read more

Returns the largest integer less than or equal to a number. Read more

Returns the smallest integer greater than or equal to a number. Read more

Returns the nearest integer to a number. Round half-way cases away from 0.0. Read more

Return the integer part of a number. Read more

Returns the fractional part of a number. Read more

Computes the absolute value of self. Returns Float::nan() if the number is Float::nan(). Read more

Returns a number that represents the sign of self. Read more

Returns true if self is positive, including +0.0 and Float::infinity(). Read more

Returns true if self is negative, including -0.0 and Float::neg_infinity(). Read more

Fused multiply-add. Computes (self * a) + b with only one rounding error. This produces a more accurate result with better performance than a separate multiplication operation followed by an add. Read more

Take the reciprocal (inverse) of a number, 1/x. Read more

Raise a number to an integer power. Read more

Raise a number to a floating point power. Read more

Take the square root of a number. Read more

Returns e^(self), (the exponential function). Read more

Returns 2^(self). Read more

Returns the natural logarithm of the number. Read more

Returns the logarithm of the number with respect to an arbitrary base. Read more

Returns the base 2 logarithm of the number. Read more

Returns the base 10 logarithm of the number. Read more

Returns the maximum of the two numbers. Read more

Returns the minimum of the two numbers. Read more

The positive difference of two numbers. Read more

Take the cubic root of a number. Read more

Calculate the length of the hypotenuse of a right-angle triangle given legs of length x and y. Read more

Computes the sine of a number (in radians). Read more

Computes the cosine of a number (in radians). Read more

Computes the tangent of a number (in radians). Read more

Computes the arcsine of a number. Return value is in radians in the range [-pi/2, pi/2] or NaN if the number is outside the range [-1, 1]. Read more

Computes the arccosine of a number. Return value is in radians in the range [0, pi] or NaN if the number is outside the range [-1, 1]. Read more

Computes the arctangent of a number. Return value is in radians in the range [-pi/2, pi/2]; Read more

Computes the four quadrant arctangent of self (y) and other (x). Read more

Simultaneously computes the sine and cosine of the number, x. Returns (sin(x), cos(x)). Read more

Returns e^(self) - 1 in a way that is accurate even if the number is close to zero. Read more

Returns ln(1+n) (natural logarithm) more accurately than if the operations were performed separately. Read more

Hyperbolic sine function. Read more

Hyperbolic cosine function. Read more

Hyperbolic tangent function. Read more

Inverse hyperbolic sine function. Read more

Inverse hyperbolic cosine function. Read more

Inverse hyperbolic tangent function. Read more

Returns the mantissa, base 2 exponent, and sign as integers, respectively. The original number can be recovered by sign * mantissa * 2 ^ exponent. The floating point encoding is documented in the [Reference][floating-point]. Read more

Converts radians to degrees. Read more

Converts degrees to radians. Read more

impl<C: FloatChecker<f32>> Into<f32> for NoisyFloat<f32, C>
[src]

Note: due to complications with Rust's type system, cannot implement Into generically like impl<F: Float, C: FloatChecker<F>> Into<F> for NoisyFloat<F, C>.

Performs the conversion.

impl<C: FloatChecker<f64>> Into<f64> for NoisyFloat<f64, C>
[src]

Note: due to complications with Rust's type system, cannot implement Into generically like impl<F: Float, C: FloatChecker<F>> Into<F> for NoisyFloat<F, C>.

Performs the conversion.

impl<F: Float + Debug, C: FloatChecker<F>> Debug for NoisyFloat<F, C>
[src]

Formats the value using the given formatter.

impl<F: Float + Display, C: FloatChecker<F>> Display for NoisyFloat<F, C>
[src]

Formats the value using the given formatter.

impl<F: Float + LowerExp, C: FloatChecker<F>> LowerExp for NoisyFloat<F, C>
[src]

Formats the value using the given formatter.

impl<F: Float + UpperExp, C: FloatChecker<F>> UpperExp for NoisyFloat<F, C>
[src]

Formats the value using the given formatter.