No this isn't a bug. This has to do with the precision of floating point numbers. As you might know, a computer is a discrete machine. Real numbers have infinitely many numbers between two reals: It is impossible for a computer to handle numbers to infinity, or even all numbers between 0.00 and 0.01 for example: There are an infinite number of reals in between.
Your computer handles reals discretely: All numbers get rounded to the closest representable floating point number; therefore floating point numbers always contain a representation error (except when the real you're looking for can be represented exactly). All small errors in the calculations account for the final error. This is what happens in your case. For more information, and the mathematical explanation: https://en.wikipedia.org/wiki/Floating_point
For an example in real life. Just run this piece of PHP code and see what happens:
$sum = 0.0;
for ($i = 0; $i < 1000; $i++) {
$sum += 0.1;
}
You would expect sum to become exactly 100, right?
Another tip about your piece of code: If you're just using ceil() to get an integer, you'd better use the round() function.