Skip to content

dongcool/near-bigdecimal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

near-bigdecimal

Big decimal for NEAR smart contracts

Examples

let a = BigDecimal::from(3_u128);
let b = BigDecimal::from(10_u128);
let c = BigDecimal::from(49_u128);

assert_eq!((a + b).round_u128(), 13);
assert_eq!((a * b).round_u128(), 30);
assert_eq!((b / a).round_u128(), 3);
assert_eq!((b.pow(2)).round_u128(), 100);
assert_eq!((c.sqrt()).round_u128(), 7);

About

Big decimal for NEAR smart contracts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages