• @backgroundcow
    link
    36 months 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.

    • @Chobbes
      link
      16 months ago

      Of course, but it’s somewhat nasty when all of a sudden is_even doesn’t do what you expect :).