Use Math.round(num * 100) / 100
Edit: to ensure things like 1.005 round correctly, we use
Math.round((num + Number.EPSILON) * 100) / 100
Use Math.round(num * 100) / 100
Edit: to ensure things like 1.005 round correctly, we use
Math.round((num + Number.EPSILON) * 100) / 100
For further actions, you may consider blocking this person and/or reporting abuse
Abhay Yt -
Md Nazmus Sakib -
Abhay Yt -
Java para Iniciantes (Oracle) -
Top comments (0)