Today, I found a bug with CEILING(). I don't know why.
Who can give me an answer, pls.
Thanks.
When I test CEILING() SQL Server 2012:
Today, I found a bug with CEILING(). I don't know why.
Who can give me an answer, pls.
Thanks.
When I test CEILING() SQL Server 2012:
This is not a bug per se. A floating point cannot represent 0.17 exactly, since it cannot be represented as a finite sum of (negative) powers of 2. Therefore 0.17 is represented by the closest representable number.
As a result 0.17 is actually represented as something like 0.170000...1. Therefore performing CEILING will represent it as 1701.
As @Squirrel says, you can use a DECIMAL which stores a number exactly for a given amount of digits.