paupino / rust-decimal

Decimal number implementation written in pure Rust suitable for financial and fixed-precision calculations.
https://docs.rs/rust_decimal/
MIT License
1.03k stars 183 forks source link

too rubbish to called rust decimal #629

Closed zzy444626905 closed 11 months ago

zzy444626905 commented 11 months ago

··· let result = Decimal::from_str("111111111111111111111111111111111111111111111111111111111111111111").unwrap(); println!("{}", result); ···

··· ErrorString("Invalid decimal: overflow from too many digits") ···

schungx commented 11 months ago

Not necessary to be rude. You don't have to use it if it doesn't suit you.

Tony-Samuels commented 11 months ago

You might be interested in BigDecimal if you want arbitrarily sized decimal numbers. This crate is for constant size, no allocation decimals; which does apply a limit to the size of numbers that can be handled.

paupino commented 11 months ago

Thanks folks! I've used this as an opportunity to update the readme to add a section calling out when this library may not be suitable and to highlight alternatives. Feel free to take a look and as always if something looks off or could be explained better then let me know (or open a PR).

In the meantime, I'll close this issue since there isn't anything actionable (other than readme clarification) that can be done.