So I thought my program was perfect until I tried to input "1.15" through this: Math.rint(amount*100)/100;
It outputs as 1.14
I don't get it. Other numbers work :( Please help, I don\'t know why is that.
Thank you!
Printable View
So I thought my program was perfect until I tried to input "1.15" through this: Math.rint(amount*100)/100;
It outputs as 1.14
I don't get it. Other numbers work :( Please help, I don\'t know why is that.
Thank you!
Might be rounding.
URGENT! Due in one hour. Please help!
Still not urgent.
I would have been inclined to help you if you weren't rude by:
Marking your post as urgent.
Imposing a deadline upon us.
Crossposting.
I had a problem similar to this not long ago and I had to implement my numbers with the BigDecimal class... Basically it was a thing calculating money and it would give out very weird values when doing very simple math ( I recall 0.07 * 3 = 0.2100000000002 or something like that).