1<?php 2function allowed_rounding_error ($number, $expected) { 3 4 //different machines may give slightly different floating point numbers 5 //This assumes that the results will be the same to + or - 1.0E-10. 6 7 $small_number = 1.0e-10; 8 $min = $expected - $small_number; 9 $max = $expected + $small_number; 10 11 if ($number < $max && $number > $min ) { 12 return true; 13 } 14 else { 15 return false; 16 } 17} 18?>