[][src]Function b2dp::utilities::discretesampling::get_sum

pub fn get_sum(
    base: &Float,
    arithmeticconfig: &ArithmeticConfig,
    start: &Float,
    end: &Float
) -> Result<Float>

Returns the sum: (1-base)*\sum_{k=start}^{end}base^{|k|}

Arguments:

Returns

Either the sum or an error if parameters are mis-specified. This method does not explicitly check for inexact arithmetic, it is the caller's responsibility to do so.

Exact Arithmetic

This method does not enforce exact arithmetic, this is the caller's responsibility.

Timing channels

Known Timing Channel: The recursive calls to get_sum introduce a timing channel distinguishing whether the sum has an infinite start or end point versus finite start and end points. In most settings, adjacent databases should not result in finite vs infinite endpoint differences. Slight timing variation due to logic between different types of infinite endpoints may be noticeable (please see benchmarks.)