• cynar@lemmy.world
    link
    fedilink
    English
    arrow-up
    16
    ·
    1 year ago

    For those confused

    2.25+2.25=4.5 rounds to 2+2=5

    2.5+2.5=5 truncates to 2+2=5

    Both can crop up in programming, depending on the situation.

    • afraid_of_zombies@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      A few months back I had a floating point that had a single 1 like 16 digits past the decimal place and I couldn’t get rid of it.