Closed Ballasi closed 1 year ago
I would like to make an attempt to add support for this by using the traits from num_traits. Do you think that should work or do you have any other ideas?
I've been thinking of the way this is meant to be implemented and mostly used by the user. I usually tend to avoid dependencies on unnecessary crates that can be re-implemented and tailored to my own crates to prevent dependency hell.
I've come across num-traits
before and saw it doesn't bring much dependencies so I think I am fine with using it, especially since it seems to fit our use case pretty well.
When it comes to usability however, I have been thinking of the use case for the user. The main ways this is going to be used (for big nums) is likely through strings, not the specific trait num-traits
makes. If num-traits
offer a From<String>
or From<&str>
, I am all in for this approach!
Num
does have from_str_radix
. Also, the popular big num crates like num-bigint, rust-decimal and others implement this trait.
I'll give it a go since the approach looks fine to you.
Implemented in commit 7114e5fbbe007bbe78cc265c633df880bba0b1fb via lib num-bigfloat.
Currently, the stack is limited to
i64
/f64
.The program needs to have support for bignum (any finite numbers).