I realise this is a 3-year-old thread that has been dredged up, but since I find floating-point numbers interesting (as a professional programmer), I thought I'd leave this link to a website I find useful: https://www.h-schmidt.net/FloatConverterÂ/IEEE754.html
It demonstrates that in general floating-point numbers can almost never represent fractions exactly (see 'Value actually stored in float'). As a result, you will always be able to find edge cases where rounding is apparently being performed incorrectly.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I realise this is a 3-year-old thread that has been dredged up, but since I find floating-point numbers interesting (as a professional programmer), I thought I'd leave this link to a website I find useful: https://www.h-schmidt.net/FloatConverterÂ/IEEE754.html
It demonstrates that in general floating-point numbers can almost never represent fractions exactly (see 'Value actually stored in float'). As a result, you will always be able to find edge cases where rounding is apparently being performed incorrectly.