Before you rant about standard libraries, you better RTFM. First, doubles have a precision of 52 bits and can therefore represent any 32bit integer exactly. In fact, they are accurate for all integers in the range [-2^52+1, 2^52-1], which a int cannot even represent. Second, if a double value is bigger than 2^52-1, it will always be a integral number and floor will always be a noop. Therefore the value returned by floor is always a accurate. (In the sense, that it's an integral number). Your approach on the other hand violates the principle of least surprise by casting to an int, unnecessarily losing precision and throwing an exception on overflows (what alternative would you have?).