Skip to content

Commit

Permalink
Fix remaining references to "increment"
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed Oct 25, 2023
1 parent d612b43 commit f5c7b15
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions utils/fixed_decimal/src/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,23 +1017,23 @@ impl FixedDecimal {
/// # Examples
///
/// ```
/// use fixed_decimal::{FixedDecimal, RoundingIncrement};
/// use fixed_decimal::{FixedDecimal, RoundingCoarseness};
/// # use std::str::FromStr;
///
/// let mut dec = FixedDecimal::from_str("-3.5").unwrap();
/// dec.trunc_with_increment(0, RoundingIncrement::I2);
/// dec.trunc_coarse(0, RoundingCoarseness::MultiplesOf2);
/// assert_eq!("-2", dec.to_string());
/// let mut dec = FixedDecimal::from_str("7.57").unwrap();
/// dec.trunc_with_increment(-1, RoundingIncrement::I5);
/// dec.trunc_coarse(-1, RoundingCoarseness::MultiplesOf5);
/// assert_eq!("7.5", dec.to_string());
/// let mut dec = FixedDecimal::from_str("5.45").unwrap();
/// dec.trunc_with_increment(-2, RoundingIncrement::I25);
/// dec.trunc_coarse(-2, RoundingCoarseness::MultiplesOf25);
/// assert_eq!("5.25", dec.to_string());
/// let mut dec = FixedDecimal::from_str("9.99").unwrap();
/// dec.trunc_with_increment(-1, RoundingIncrement::I25);
/// dec.trunc_coarse(-1, RoundingCoarseness::MultiplesOf25);
/// assert_eq!("7.5", dec.to_string());
/// let mut dec = FixedDecimal::from_str("9.99").unwrap();
/// dec.trunc_with_increment(-2, RoundingIncrement::I2);
/// dec.trunc_coarse(-2, RoundingCoarseness::MultiplesOf2);
/// assert_eq!("9.98", dec.to_string());
/// ```
pub fn trunc_coarse(&mut self, position: i16, coarseness: RoundingCoarseness) {
Expand All @@ -1049,8 +1049,8 @@ impl FixedDecimal {
self.upper_magnitude = cmp::max(self.upper_magnitude, magnitude);

// 2. If the rounding position is *lower than* the rightmost nonzero digit and we're
// not rounding to a custom increment, exit early.
// Don't exit if the increment is not `1`, because the algorithm could need to truncate the
// rounding to a coarseness of 1, exit early.
// Don't exit if the coarseness is not `1`, because the next steps could need to truncate the
// last non-zero digit.
if self.is_zero()
|| (magnitude < self.nonzero_magnitude_end()
Expand Down

0 comments on commit f5c7b15

Please sign in to comment.