• nous@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    The lesson here is that floating point numbers are not exact and that you should never do a straight comparison with them. Instead check to see if they are within some small tolerance of each other. In python that is done with math.isclose(0.1 + 0.2, 0.3).