Merge pull request #334 from arv/fix-math-precision

Fix issue with math_precision.js
This commit is contained in:
Brian Terlson 2015-06-25 14:19:47 -07:00
commit 55740e93d6
1 changed files with 11 additions and 13 deletions

View File

@ -1,13 +1,11 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
function getPrecision(num)
{
function getPrecision(num) {
//TODO: Create a table of prec's,
// because using Math for testing Math isn't that correct.
log2num = Math.log(Math.abs(num))/Math.LN2;
pernum = Math.ceil(log2num);
return(2 * Math.pow(2, -52 + pernum));
//return(0);
var log2num = Math.log(Math.abs(num)) / Math.LN2;
var pernum = Math.ceil(log2num);
return 2 * Math.pow(2, -52 + pernum);
}