Help for this page

Select Code to Download


  1. or download this
    # absolute error method
    $is_within_tolerance = abs($value - $expected) < EPSILON;
    
    # relative error method - $tolerance_error should be within threshold 
    +percentage
    $tolerance_error = abs(($value - $expected) / $expected);