Skip to content

Commit

Permalink
float...
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Apr 9, 2024
1 parent 2a7a6a9 commit 7a391b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/cvm/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ impl Amount {
// with rounding to reduce or reduce down part up to some seven bit parts
pub const MAX_PARTS: u64 = 1_000_000_000_000_000_000;

#[cfg(not(feature = "cosmwasm"))]
pub fn try_floor_f64(value: f64) -> Result<Self, ArithmeticError> {
#[cfg(feature = "native")]
pub fn try_floor_ratio(value: Ratio<u128>) -> Result<Self, ArithmeticError> {
if value < 0.0 || value.is_nan() {
Err(ArithmeticError::Underflow)
} else if value > u128::MAX as f64 {
} else if value > u128::MAX {
Err(ArithmeticError::Underflow)
} else {
Ok((value as u128).into())
Expand Down

0 comments on commit 7a391b5

Please sign in to comment.