1

I just have a problem with a sum in php. My data are :

$t = array('-100.80',
'-0.01',
'-7.99',
'-108.00',
'-10.80',
'-34.90',
'-10.80',
'-18.80',
'-17.80',
'-19.50',
'-33.60',
'-32.10',
'-27.50',
'-40.30',
'-31.20',
'-10.60',
'-27.50',
'-120.00',
'-130.00',
'100.80',
'0.01',
'7.99',
'108.00',
'10.80',
'34.90',
'10.80',
'18.80',
'17.80',
'19.50',
'33.60',
'32.10',
'27.50',
'40.30',
'31.20',
'10.60',
'27.50',
'120.00',
'130.00');

Total is normally 0 but if i execute an array_sum i just have :

-5.6843418860808E-14

If i add manually with floatVal() i just have the same result.

Could you explain me why i don't have 0 in result ?

Thanks.

Regards,

Sahil Gulati
  • 15,028
  • 4
  • 24
  • 42
Zozor
  • 23
  • 3

0 Answers0