akubera / bigdecimal-rs

Arbitrary precision decimal crate for Rust
Other
275 stars 71 forks source link

BUG: override default FromPrimitive implementation for u128 and i128 #101

Closed qdrs closed 1 year ago

qdrs commented 1 year ago

The default FromPrimitive implementation for BigDecimal::from_u128 and BigDecimal::from_i128 goes through u64 and i64 respectively, rendering the default implementation useless as any number greater than 64 bits won't be parseable into a 128 bit number. The default implementation currently used can be found here:

https://github.com/rust-num/num-traits/blob/4ac94b4136ea06d0bd0e1b8abe30c55a45acffdf/src/cast.rs#L476

I have overridden the default implementation so that this function actually works as intended.