Created
December 30, 2017 21:22
-
-
Save leachdaniel/7e43fff3b91969ec4d372c56f2b808c8 to your computer and use it in GitHub Desktop.
JavaScript Rounding
This file contains 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
if ((14.28*9 != 128.52) || (66.66*5 != 333.3) || (21.17*6 != 127.02)) { | |
document.write("<b>Rounding Errors Detected:</b><BR><BR>");} | |
else {document.write("<b>No Rounding Errors Detected:</b><BR><BR>"); } | |
document.write("14.28 x 9 should be <b>128.52</b>;<br><small>your browser's answer = </small><b>" + (14.28*9)+"</b><br><br>"); | |
document.write("66.66 x 5 should be <b>333.3</b>;<br><small>your browser's answer = </small><b>" + (66.66 * 5)+"</b><br><br>"); | |
document.write("21.17 x 6 should be <b>127.02</b>;<br><small>your browser's answer = </small><b>" + (21.17*6)+"</b><br><br>"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment