I need to do division of currency amounts in SS2. ...
# suitescript
c
I need to do division of currency amounts in SS2. I don't want JS floating point issues to cause problems. What do I do?
w
Number((your division operation).toFixed(2)) might do the trick.
b
I personally recommend just doing the division and round it at the end with something like
Copy code
function roundToTwo(num) {    
    return +(Math.round(num + "e+2")  + "e-2");
}
if you require higher precision'
you can use something like
c
Thank you