INTERPOLATION_PRECISION

Constant INTERPOLATION_PRECISION 

Source
const INTERPOLATION_PRECISION: usize = 1_000_000;
Expand description

Precision multiplier for linear interpolation calculations.

This value of 1,000,000 was chosen to balance precision with overflow safety:

  • Provides 6 decimal places of precision for the fractional component
  • Small enough to avoid overflow when multiplied with typical numeric values
  • Sufficient precision for most statistical applications

The interpolation formula: lower + (upper - lower) * fraction is computed as: lower + ((upper - lower) * (fraction * PRECISION)) / PRECISION to avoid floating-point operations on integer types while maintaining precision.