Ever wondered why Oracle Intelligent Advisor, and a myriad of other applications, don’t calculate remainders properly? The Forum recently hosted a question about Remainder() errors that allowed us, in the response, to detail just why it does not work – and that it does not work in Excel, Lotus 123, or any other modern computer software. Blame someone else!
There are lots of articles on the Internet that delve into the details of why rounding doesn’t work, and it comes down to how floating point arithmetic is implemented thanks to an IEEE specification. The idea is that the storage of such numbers should not take up too much space in your computer memory.
Here is an article about it on the Microsoft site, specifically dealing with Excel.
In Oracle Intelligent Advisor, when using a dividend of 0.912 and a divisor of 0.048 for example, the remainder should show as 0. But this is what you get in terms of a Remainder.
So the floating point problem raises its head. The answer shown in A is not what you would expect for the following rule A.
In both cases, B shows the Remainder workaround and the expected result in the Debugger. Find out more about it here on the IEEEE website. For more interesting content around Oracle Intelligent Advisor, here are some suggestions.