• Offtopic: Try 0.1+0.2 in nodejs(v10.15.1) and in Espruino (2v04.6).
    Results are 0.30000000000000004 for nodejs and 0.3 for Espruino.

    That's Javascript, and you should always keep in mind how numbers are represented internally.

    Ontopic (Espruino 2v04.6)

    >Math.pow(2,19)
    =524288
    
    >915E6*Math.pow(2,19)
    =479723519999999.9375
    
    >915E6*524288
    =479723520000000
    

    and one fix is to manually round the pow result:

    >915E6*Math.round(Math.pow(2,19))
    =479723520000000
    
    //because
    >524288 === Math.pow(2,19)
    =false
    
    >524288 === Math.round(Math.pow(2,19))
    =true
    

    Another fix is to use 524288 instead of Math.pow(2,19) for this calculation.
    And of course that result should be rounded before it is used for binary operations.

About

Avatar for maze1980 @maze1980 started