aboutsummaryrefslogtreecommitdiffstats
path: root/console/harness/math_isequal.js
blob: a68434e075d645cc6ebc83de2efebfc9028ebfe6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

var prec;
function isEqual(num1, num2)
{
        if ((num1 === Infinity)&&(num2 === Infinity))
        {
                return(true);
        }
        if ((num1 === -Infinity)&&(num2 === -Infinity))
        {
                return(true);
        }
        prec = getPrecision(Math.min(Math.abs(num1), Math.abs(num2)));  
        return(Math.abs(num1 - num2) <= prec);
        //return(num1 === num2);
}