Skip to main content

value_to_steps_up

Function value_to_steps_up 

Source
pub fn value_to_steps_up(
    value: Decimal,
    step: Decimal,
) -> Result<i64, PrecisionError>
Expand description

Converts a value to a whole number of steps, rounding up (towards positive infinity).

§Errors

The same as value_to_steps_nearest.

§Examples

use brokapi_bcs_protocol::utils::precision::value_to_steps_up;
use rust_decimal::Decimal;

assert_eq!(value_to_steps_up(Decimal::new(10103, 2), Decimal::new(5, 2))?, 2021);