-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add a BigDecimal type #8937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This should be pretty easy. The hard part is getting it performant. Not particularly important. |
Sorry for a probably stupid question, isn't BigRational and BigDecimal functionally the same thing? They all represent rational numbers right? |
|
I thought I was a decent computer scientist, then I met this community xD |
May I claim this issue? I will need to give this more thoughts, but atm I think this should work: struct BigDecimal {
value: BigInt,
scale: BigInt,
// ... some other fields if needed
} And the actual value will just be Any thoughts? |
Go for it! If that's what Java does and there's no alternative numerics On Fri, Jan 10, 2014 at 10:30 AM, Derek Chiang (Enchi Jiang) <
|
I think you mean |
@huonw indeed. Fixed. |
Maybe a BigDouble, could be done with struct BigDouble { Sometime arbitrary precision library are done with integer, wich could be much slower than using 2 or 3 double, with the correct operation. |
Off topic question: is there a good reason why is this labeled with both |
@mrshu writing a BigDecimal is easy. Writing a good BigDecimal is hard. |
Since I see there has been no progress here, I am going to implement this. |
Is there any particular problem with just wrapping libgmp for this sort of stuff? Seems like C++ libs wrap the C code easily enough. |
I would personally be in favor of dumping our current BigInt stuff and wrapping GMP ( |
I think it is a good idea... Porting the code from Java is a non-trivial task and will probably perform worse than libgmp. |
GMP has many hardware-specific optimizations. It does not seem feasible to me to reimplement them in Rust. |
I think this should be implemented on top of MPFR [1]. Similarly, About LGPL: I think we should be fine if we dynamically link against it (like it is done in rust-gmp [3]). [1] http://www.mpfr.org/ |
This issue has been moved to the RFCs repo: rust-lang/rfcs#334 |
This issue has been moved to the RFCs repo: rust-num/num#8 |
Merge various passes into `Matches` changelog: None
libextra already has
BigInt
,BigUint
andBigRational
but not an arbitrary precision decimal type similar to Java'sBigDecimal
or SQL'sNUMERIC
type.The text was updated successfully, but these errors were encountered: