Matt
Two things you may have misunderstood...
1. This is not a "we do your homework" servce. Somebody may help you learn how to round your results, but nobody will just do it for you.
2. This is the Java forum. Java and JavaScript are not the same thing at all.
So: Please post a request for assistance in learning how to round values, and post it in the Web Development / JavaScript forum
Good luck
J
JamesCherrill
... trying to help
8,516 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,455
Skill Endorsements: 30
Question Answered as of 5 Months Ago by
JamesCherrill James, do you know that the link of JavaScript forum (or anything that are in the same web-development category) is broken? I am not sure if it is from the server URL-rewriting or something else... That may be the reason why this person posted here.
Anyway, to answer to the question (even though the thread is closed), you should parse the number, multiply by 100, compute the result, round it, then divide it again by 100.
var a = 234.244
var b = 51.654
var upA = a*100
var upB = b*100
var resA = Math.round((upA*3.35)) / 100 // <= 784.72
var resB = Math.round((upB*3.35)) / 100 // <= 173.04
Taywin
Posting Maven
2,633 posts since Apr 2010
Reputation Points: 275
Solved Threads: 375
Skill Endorsements: 17
James, do you know that the link of JavaScript forum (or anything that are in the same web-development category) is broken?
Do you mean the drop-down "Web Development" menu near the top of the page? It's working OK for me...
JamesCherrill
... trying to help
8,516 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,455
Skill Endorsements: 30
Taywin
Posting Maven
2,633 posts since Apr 2010
Reputation Points: 275
Solved Threads: 375
Skill Endorsements: 17
JamesCherrill
... trying to help
8,516 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,455
Skill Endorsements: 30
Thanks James. Problem solved. Reinstalled Firefox because it seems that my FF broke for some reason.
Taywin
Posting Maven
2,633 posts since Apr 2010
Reputation Points: 275
Solved Threads: 375
Skill Endorsements: 17