JavaScript division

JavaScript division

Hello there,

I'm doing a simple division like this in JavaScript

  1. var A = $('#Up').val(); //0.3
    var B = $('#Down').val(); //3
    var result = A/B; //0.09999999999999999

Windows calculator or calculator on my phone gives me 0.1. So it is doing rounding. Instead of 0.1 why am I'm getting 0.09999999999999999 when I divide 0.3/3?

Joe