I was working on a Project Euler problem and discovered what looks like a bug in the floor function; with some large numbers d, floor(Int, d/9) seems to round up instead of down. I haven’t looked into it too much, but one example of this behaviour is with d = 37889062372043916:
Of course, for what I want to do, I should probably have used the ÷ operator instead of the floor function with an Int argument from the get-go. I’m curious though as to whether this is a real bug or just something that should be flagged in the documentation, which currently says
floor(T, x) converts the result to type T, throwing an InexactError if the value is not representable."
making no promises the converted value will be the true floor.
I agree, though I’m not sure what a better version of this documentation would look like. Perhaps it could be more explicit in specifying that floor(T, x) is simply defined as convert(T, x), so one can refer to the documentation for the latter for more information on how that’s implemented.