Microsoft Excel uses its own double type on a specific machine to perform its calculations. I donโt know exactly what PHP is using.
However, it should be noted that even copying a floating-point number on x86-based machines can change its value. Floating points are stored inside registers with a width of 80 bits. They are stored in memory in blocks of 64 bits wide. Therefore, assuming that Excel and PHP work on x86-based computers, you can get different values โโeven with similar calculations. In particular, to the extremes of ranges supported by floating point types.
Finally, there is an obvious difference between double that Excel uses, and (if your PHP code uses one) float in PHP code. Make sure you are not incompatible with them, since float have much less precision.
EDIT: Forget about this too - there will be differences in output if PHP or Excel (rather, Excel) use / use the SSE extensions, since their floating point operations work on 64 bits, not 80 bits, double.
source share