[ create a new paste ] login | about

Link: http://codepad.org/r2sWP5vc    [ raw code | output | fork ]

PHP, pasted on Dec 10:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php

$a = 1.62149999999999994;
$b = 1.6214999999999995;

$delta = abs($a - $b);

echo "Absolute difference: " . $delta . "\n";


$my_desired_delta = 0.00000000000001;

if (abs($a - $b) < $my_desired_delta)
echo "Equal";


Output:
1
2
Absolute difference: 4.4408920985006E-16
Equal


Create a new paste based on this one


Comments: