cmpute commented on PR #2299:
URL: https://github.com/apache/avro/pull/2299#issuecomment-1783650626

   Thanks for your interest! Some of the benefits of choosing dashu over 
bigdecimal:
   
   1. dashu is faster: benchmark of exp indicates that `dashu::Decimal` 
calculates exp(1) with 100 digits in 10ms while `bigdecimal::BigDecimal` spends 
15ms (on my laptop). You can try [the 
benchmark](https://github.com/cmpute/dashu/tree/bench/benchmark) here.
   2. dashu has thorough context and rounding support: dashu supports arbitrary 
precision limit at runtime, while bigdecimal only partially support setting 
precision at compile time. The correctness of bigdecimal with higher precision 
is not well tested. Dashu supports rounding mode and precision selection for 
each operation, while bigdecimal's context type only allows you to select them 
on the very basic operation (addition) yet.
   3. dashu supports arbitrary float base: dashu has decimal float type 
`dashu::Decimal`, it also has the binary float type `dashu::Real`. The decimal 
type can be converted from and to the binary type efficiently with rounding 
mode with the method 
[`with_base`](https://docs.rs/dashu/0.4.0/dashu/float/type.DBig.html#method.with_base)
 and 
[`with_base_and_precision`](https://docs.rs/dashu/0.4.0/dashu/float/type.DBig.html#method.with_base_and_precision).
 Therefore you can have a complete control when you want to convert 
f32/f64/other binary floats to decimal outputs (you can specify the precision 
or the rounding mode you want)
   4. dashu has seamless and opaque support for conversion between big integers 
and big decimals through 
[`from_parts`](https://docs.rs/dashu/0.4.0/dashu/float/type.DBig.html#method.from_parts)
 and 
[`into_repr`](https://docs.rs/dashu/0.4.0/dashu/float/type.DBig.html#method.into_repr).
 After all, dashu is a collection of arbitrary precision integers, rationals 
and floats.
   
   I can't say that dashu has a better API right now, but I'm working on a 
guide book in the next release.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to