> Because the result is an infinite repeating decimal, in my opinion, your
Decimal class should not allow such a division without explicitly
specifying a scale and a rounding mode. In other words, I would expect an
exception here.
There is already an internal flag for inexact division, but is curr
>
> I recognize some of the patterns from OpenJDK's BigDecimal source. :)
Indeed, Brick\Math was largely inspired by Java's implementation!
The major difference to me is scale vs precision, ie. number of significant
> digits vs number of digits behind the decimal point. Not sure which is
> bette
Hi Benjamin,
Brick\Math looks awesome. I really like the static initializers and
descriptive method names. I recognize some of the patterns from OpenJDK's
BigDecimal source. :)
The major difference to me is scale vs precision, ie. number of significant
digits vs number of digits behind the decima
Just for the record, I've written a userland arbitrary precision arithmetic
library, that provides a BigDecimal class which should be pretty similar to
what you're aiming to do:
https://github.com/brick/math
This library uses the existing GMP or BCMath extensions when available, but
also works