### Xampp / PHP inconsistent float calculations

Posted:

**17. September 2010 13:52**First off - excellent package

I have recently installed Xampp 1.7.3 on a new Windows 7 laptop to continue working on a php project (well trying to learn php actually).

I am trying to do some calculations of a few floats but sometimes the calculation produce the wrong results, either text or 0.0000000000.

For example I have the following code.

$diff is a DateInterval object, this calculation is carried out 6 times in a loop, 2 out of 6 times the result = 0.0000000000.

exactly the same for

This happens every time, I have tried var_dump and the type is correct.

Any help appreciated.

Regards

Mark

I have recently installed Xampp 1.7.3 on a new Windows 7 laptop to continue working on a php project (well trying to learn php actually).

I am trying to do some calculations of a few floats but sometimes the calculation produce the wrong results, either text or 0.0000000000.

For example I have the following code.

- Code: Select all
`$total = $diff->y * 365.25;`

$diff is a DateInterval object, this calculation is carried out 6 times in a loop, 2 out of 6 times the result = 0.0000000000.

exactly the same for

- Code: Select all
`$total = ceil($period);`

This happens every time, I have tried var_dump and the type is correct.

Any help appreciated.

Regards

Mark