Struct kahan::KahanSum [] [src]

pub struct KahanSum<T: Float> { /* fields omitted */ }

Methods

impl<T: Float> KahanSum<T>
[src]

Represents an ongoing Kahan summation. New terms can be added to the sum by simple addition.

Examples

let mut kahan_sum = KahanSum::new();
kahan_sum += 10000.0f32;
kahan_sum += 3.14159f32;
assert_eq!(10003.142f32, kahan_sum.sum());
assert_eq!(0.000011444092f32, kahan_sum.err());

[src]

Creates a new KahanSum with sum and err initialized to 0

[src]

Creates a new KahanSum with starting sum set to initial, but err initalized to 0

[src]

Returns the current running sum

[src]

Returns the current error value

Trait Implementations

impl<T: Debug + Float> Debug for KahanSum<T>
[src]

[src]

Formats the value using the given formatter.

impl<T: Clone + Float> Clone for KahanSum<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Float> Default for KahanSum<T>
[src]

[src]

Returns the "default value" for a type. Read more

impl<T: Float> AddAssign<T> for KahanSum<T>
[src]

[src]

Performs the += operation.

impl<T: Float> Add<T> for KahanSum<T>
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.