# Floating-point division imperfection

I know that the floating-point is not perfect, either it's float or double, but does it mean that, when I divide one floating-point number by another and the the dividend is divisible by the divider without a reminder (like 10000.0 is divisible by 10.0), is it possible that I get a number with .99999999... at the end which is only smaller than the correct result by a tiny fraction. Can such thing happen with floating-points?

I need to know because I need to apply floor function after the division and it would make a huge difference if floating-point divisions are really that imperfect.

## Answers

does it mean that, when I divide one floating-point number by another and the the dividend is divisible by the divider without a reminder (like 10000.0 is divisible by 10.0), it's possible that I get a number with .99999999... at the end

No. IEEE 754 division is correctly rounded. If there is a representable floating-point number (1000 in your example) for the result, this is the result you will get for the division.

What can happen is that you do not divide the numbers you are thinking, because you wrote 0.1 and you think that this represents the mathematical value 0.1. In this case the end result can be surprising, but this is no fault of the floating-point division.

As long that you know that you are dividing the numbers you mean, if the mathematical result of the division is, say, an integer below 224, then the result of the floating-point division will be that integer.