51% + 50% = ? - eviltoast
  • Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    32
    ·
    3 months ago

    rounding half up

    round(49.5) + round(50.5)
    50 + 51
    

    as opposed to banker’s rounding / rounding half to even:

    round(49.5) + round(50.5)
    50 + 50
    
  • Dudewitbow@lemmy.zip
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    3 months ago

    there are different methods of rounding, and this one is likely caused by the always round up method when at a .5 value. there are methods that evenly distribute rounding, or at least attempt to.