0

I'm converting a financial spreadsheet from Excel to a PHP-based system. I have an issue with precision because, it seems, Excel and PHP are pretty different on how they handle results of calculus.

https://en.wikipedia.org/wiki/Numeric_precision_in_Microsoft_Excel http://php.net/manual/en/language.types.float.php

Example: Going from the same input numbers, after several iterations PHP gives 1069,22 and Excel gives 1070,60.

Even if Excel has worse accuracy, the client wants the numbers to be emulated like in it.

Any help is greatly appreciated.

Thanks!

Sorin Trimbitas
  • 1,467
  • 18
  • 35
  • maybe this helps https://stackoverflow.com/questions/14587290/can-i-rely-on-php-php-ini-precision-workaround-for-floating-point-issue – R A Sep 29 '17 at 11:52
  • Please explain the problem in more detail. What exactly are you trying to calculate? What formula or algorithm are you using? – Robert Lozyniak Oct 06 '17 at 06:45
  • @RobertLozyniak ... it is nothing specific. Think of fractions and simple formulas that start with the same numbers, but then, due to different rounding rounds they end up different. – Sorin Trimbitas Oct 06 '17 at 14:41

0 Answers0