• backgroundcow@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    Ackchyually-- IEEE 754 guarantees any integer with absolute value less than 2^24 to be exactly representable as a single precision float. So, the “divide by 2, check for decimals” should be safe as long as the origin of the number being checked is somewhat reasonable.