Skip to main content

precision_from_raw

Function precision_from_raw 

Source
pub fn precision_from_raw(value: i64) -> u8
Expand description

Computes the minimum decimal precision needed to represent a raw price value expressed in units of 1e-9, by counting trailing decimal zeros.

For example, a raw value of 3_906_250 (representing 0.00390625) has 1 trailing zero, so the precision is 9 - 1 = 8.