floating point errors

  • i have this function:

    round(number*1000000000)/1000000000

    i use it on all of my sprite font numbers, in order to avoid floating points error.

    This work for 99% of the cases, and fixes most error caused by multiplying numbers

    Yet, a number like this: 4418829.9

    will be converted to: 4418829.900000001

    i need to support up to 6 digits after dot

    i dont understand how float number works and i need help

    *simply removing a single 0 from 1000000000, seems to fix it for this specifc number

    *i thought also trying to cut the last digit because i dont need that many

    *but, if i try those fixes i will not know for sure the problem is fixed

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • this might have happend because the bumber was too long

    im going to split the number to 2 parts

    right and left side of decimal point

    im going to use the rounding only on the right part and the sum 2 parts

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)