Created
September 22, 2015 19:51
-
-
Save arturaugusto/1f5a3531f4030dc7f8e8 to your computer and use it in GitHub Desktop.
Numerical tolerance associated with a numerical value on javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // JCGM_101_2008 | |
| // Numerical tolerance associated with a numerical value on javascript | |
| // page 31 | |
| //Example 1 | |
| a=0.00035;n=2;parseFloat("1e"+(a/(Math.pow(10,n-1))).toExponential().split("e")[1])/2 | |
| //Example 2 | |
| a=0.0004;n=1;parseFloat("1e"+(a/(Math.pow(10,n-1))).toExponential().split("e")[1])/2 | |
| //Example 3 | |
| a=2;n=1;parseFloat("1e"+(a/(Math.pow(10,n-1))).toExponential().split("e")[1])/2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment