• Thank you so much @fanoush and @Gordon for the explanation.
    @Gordon : the values doesn't always have 6 decimal places, it could be at times 5 or at times none.
    1180.952381 and 1180.95238100000 are the same number, however, I was just curious to know why values like 1175.824176 get stored as 1175.82417599999 or with extra zeroes at the end.

    Thanks for all your help as always!

  • Wed 2021.02.17

    post 13 'I was just curious to know why . . . '

    @NewAtEspruino while I don't have a solution to your initial inquiry, I am able to provide a link to a wealth of other links that should assist in your curosity discovery.

    The simple answer is found in the differences and complexities that result when using both
    Base2 and Base10

    I noticed in post #1 that text chars ref: \r\n and indexOf() provide a representation of what a microprocessor actually stores in it's Base2 equivalent. Humans view a representation of a number that we know as a numeral 0 - 9 (a String element or Char representation of a Base10 numeral) while the underlying mechanism relies on a 'Charateristic' and 'Mantissa' (Floating Point) that allows the magic of binary numbers to work.

    Had to revisit this topic over a year ago and included many links and examples to how floating point works under the hood. Note in post #4 (there) the number of digit differences between browsers and Espruino

    Number.toFixed() not rounding