Wayniac Posted March 26, 2010 Share Posted March 26, 2010 This issue I am having is it seems every time this calculation is made on whatever the value may be, its always off by either a positive several cents or a negative several cents. I tracked the reason down to it not rounding to the nearest 10. Thus resulting in a bunch of random decimals being calculated together instead of rounded and then calculated... In this case, the end value should be 31.04, but instead its 31.43. FYI: Variable v1 = 1 in this circumstance... document.getElementById("txt_price2").value = v1 * 24.95 * 1.0795 + 9.50 - 5.00; Really appreciate some way in getting this to round off properly... Quote Link to comment Share on other sites More sharing options...
hcdarkmage Posted March 26, 2010 Share Posted March 26, 2010 In this case, the end value should be 31.04, but instead its 31.43. FYI: Variable v1 = 1 in this circumstance... document.getElementById("txt_price2").value = v1 * 24.95 * 1.0795 + 9.50 - 5.00; Really appreciate some way in getting this to round off properly... Apparently, it is rounding off properly, unless I read the equation wrong. According to my calculator, my result is 31.433525, essentially 31.43. Quote Link to comment Share on other sites More sharing options...
Wayniac Posted March 26, 2010 Author Share Posted March 26, 2010 Well... this is a little embarrassing... Thank you for correcting my ignorance to triple check. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.