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

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);
}