Hey guys, I just ran into a weird issue with adding numbers in javascript. Most numbers add up fine, but when I try to add 23.2 and 33.9, I always get 57.099999999999994, instead of 57.1. W-T-F?

Here are some different ways I found online for adding numbers, all with the same result.

var add1 = parseFloat(23.2) + parseFloat(33.9);

Mojo.Log.error("Added 1: " + add1) ;

var add2 = 23.2 + 33.9;

Mojo.Log.error("Added 2: " + add2) ;

var add3 = (23.2 * 1) + (33.9 * 1);

Mojo.Log.error("Added 3: " + add3) ;

var add4 = +23.2 + +33.9;

Mojo.Log.error("Added 4: " + add4) ;

var add5 = eval(23.2) + eval(33.9);

Mojo.Log.error("Added 5: " + add5) ;

Try it, very weird.

Thanks!

David B.