[][src]Struct uncertainty::RelUnc

pub struct RelUnc { /* fields omitted */ }

Methods

impl RelUnc[src]

pub fn new(val: f64, unc: f64) -> RelUnc[src]

Create a relative uncertainty. The first parameter is the base value, and the second parameter is the relative uncertainty in the value, expressed as a decimal fraction.

Examples

use uncertainty::*;
let u: RelUnc = RelUnc::new(10.0, 0.1);
assert_eq!(u.val(), 10.0);
assert_eq!(u.unc(), 0.1);

pub fn powi(self, power: i32) -> RelUnc[src]

Raise a relative uncertainty to an integer power.

Potential problems

Casts the i32 to an f64 in order to calculate the change in uncertainty.

Examples

let two = RelUnc::new(2.0, 0.01);
let eight = two.powi(3);
assert_abs_diff_eq!(eight.val(), 8.0);
assert_abs_diff_eq!(eight.unc(), 0.03);

pub fn powf(self, power: f64) -> RelUnc[src]

Raise a relative uncertainty to an floating power.

Examples

let two = RelUnc::new(2.0, 0.01);
let eight = two.powf(3.0);
assert_abs_diff_eq!(eight.val(), 8.0);
assert_abs_diff_eq!(eight.unc(), 0.03);

Trait Implementations

impl Uncertainty for RelUnc[src]

fn min(&self) -> f64[src]

Return the minimum possible value of the uncertainty. This is functionally the base value - the uncertainty value. Read more

fn max(&self) -> f64[src]

Return the maximum possible value of the uncertainty. This is functionally the base value + the uncertainty value. Read more

fn overlap<T: Uncertainty>(&self, other: &T) -> bool[src]

Given two uncertainty values, determine whether they overlap. This is done by comparing the minimums and maximums to see whether they intersect. Intersecting uncertainties are said to be equal or overlap. Read more

impl From<f64> for RelUnc[src]

impl From<RelUnc> for AbUnc[src]

impl From<AbUnc> for RelUnc[src]

impl Clone for RelUnc[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Copy for RelUnc[src]

impl Display for RelUnc[src]

impl Debug for RelUnc[src]

impl Div<RelUnc> for RelUnc[src]

type Output = RelUnc

The resulting type after applying the / operator.

impl Div<f64> for RelUnc[src]

type Output = RelUnc

The resulting type after applying the / operator.

impl Div<RelUnc> for f64[src]

type Output = RelUnc

The resulting type after applying the / operator.

impl Mul<RelUnc> for RelUnc[src]

type Output = RelUnc

The resulting type after applying the * operator.

impl Mul<f64> for RelUnc[src]

type Output = RelUnc

The resulting type after applying the * operator.

impl Mul<RelUnc> for f64[src]

type Output = RelUnc

The resulting type after applying the * operator.

Auto Trait Implementations

impl Send for RelUnc

impl Unpin for RelUnc

impl Sync for RelUnc

impl UnwindSafe for RelUnc

impl RefUnwindSafe for RelUnc

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]