[PHP-DEV] Re: Extension: arbitrary precision decimal arithmetic in PHP 7

2018-10-27 Thread Rudi Theunissen
> 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

[PHP-DEV] Re: Extension: arbitrary precision decimal arithmetic in PHP 7

2018-10-27 Thread Benjamin Morel
> > 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

[PHP-DEV] Re: Extension: arbitrary precision decimal arithmetic in PHP 7

2018-10-26 Thread Rudi Theunissen
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

[PHP-DEV] Re: Extension: arbitrary precision decimal arithmetic in PHP 7

2018-10-23 Thread Benjamin Morel
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