moneyphp / money

PHP implementation of Fowler's Money pattern.
http://moneyphp.org
MIT License
4.6k stars 440 forks source link

Precission problem when format? #665

Closed mrtnzagustin closed 3 years ago

mrtnzagustin commented 3 years ago

In line https://github.com/moneyphp/money/blob/c4cb602e46a850fdc88aa5d7ee0a62d2269f9ae4/src/Formatter/IntlMoneyFormatter.php#L59 you convert the string number to float.. if that string have more than 14 digits (int + decimal part count), here you are losing the precission of bcmath. Isn't that a problem?

If this is a limitation for using intl, is there any other way you think we can use to format using locale but with bcmath precission?

Now, i am trying to reuse your https://github.com/moneyphp/money/blob/master/src/Formatter/DecimalMoneyFormatter.php.

frederikbosch commented 3 years ago

There is no other option as formatCurrency only accepts float. If you happen to know how to use intl with bcmath precision, please suggest how, then I am happy to look in to it. Because as far as I am aware of, this is not possible.

frederikbosch commented 3 years ago

Closing due to inactivity