Skip to content

Instantly share code, notes, and snippets.

@silentmatt
Created February 14, 2010 19:12
Show Gist options
  • Save silentmatt/304194 to your computer and use it in GitHub Desktop.
Save silentmatt/304194 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous revised this gist Feb 14, 2010. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion approximatelyEqual.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    function approximatelyEqual(a, b, tolerance) {
    return Math.abs(a - b) < tolerance;
    }
    }

    approximatelyEqual(0.1 + 0.2, 0.3, 1e-12); // true
  2. @invalid-email-address Anonymous created this gist Feb 14, 2010.
    3 changes: 3 additions & 0 deletions approximatelyEqual.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    function approximatelyEqual(a, b, tolerance) {
    return Math.abs(a - b) < tolerance;
    }