Skip to content
Snippets Groups Projects
Commit 55740e93 authored by Brian Terlson's avatar Brian Terlson
Browse files

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

Fix issue with math_precision.js
parents c295916c 96e5b67c
No related branches found
No related tags found
No related merge requests found
// Copyright 2009 the Sputnik authors. All rights reserved. // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // 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,
//TODO: Create a table of prec's, // because using Math for testing Math isn't that correct.
// because using Math for testing Math isn't that correct.
var log2num = Math.log(Math.abs(num)) / Math.LN2;
log2num = Math.log(Math.abs(num))/Math.LN2; var pernum = Math.ceil(log2num);
pernum = Math.ceil(log2num); return 2 * Math.pow(2, -52 + pernum);
return(2 * Math.pow(2, -52 + pernum)); }
//return(0);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment