Skip to main content

validate_price_precision

Function validate_price_precision 

Source
pub fn validate_price_precision(
    price: f64,
    max_sig_figs: usize,
) -> Result<(), String>
Expand description

Validate that a price has at most the specified number of significant figures.

§Arguments

  • price - The price to validate (as Decimal)
  • max_sig_figs - Maximum allowed significant figures

§Returns

Ok(()) if valid, Err with descriptive message if invalid