1

I have following code for example:

<?php

print 1 - 0.8 - 0.2 . PHP_EOL;

print 1 - 0.2 - 0.8 . PHP_EOL;

print 1 - 0.2 . PHP_EOL; 

print 1 - 0.8 . PHP_EOL;

print 0.2 - 0.2 . PHP_EOL; 

And after execution it has output:

-5.5511151231258E-17
0
0.8
0.2
0

How did -5.5511151231258E-17 ? Why? I am confused...

Example link: http://sandbox.onlinephpfunctions.com/code/bc4c31db76fa9746d76e8ac7ac4042777e095b81

Viktor Kulikov
  • 269
  • 2
  • 12

0 Answers0