SQL Server FLOOR function does not seem to always round properly

sedddrayyssa

New Member
I am using SQL Server 2008 R2.I understand that the \[code\]FLOOR\[/code\] function drops the number to the lowest integer value e.g. \[code\]FLOOR(3.424) = 3\[/code\].However when I perform this mathematical equation on a large list of numbers I find that I receive a weird pattern of the FLOOR function almost rounding too far down every 3 or 4 calculations.\[code\]Select FLOOR(dbo.Birds.weight * 1000) * .001 as [Weight],Count(1) as 'Count'From dbo.Birds\[/code\]Results:\[code\]Count Weight587 2.786 0 2.787 291 2.788 514 2.789 269 2.790 0 2.791 517 2.792 267 2.793 0 2.794 274 2.795 546 2.796 0 2.797 268 2.798 543 2.799 0 2.800 271 2.801\[/code\]Notice some of the counts next to the 0's almost appear to be double the size of the other counts.Then if I do a \[code\]select Count(*)\[/code\] statement for the weights that I received a count of 0 for I receive positive counts. Am I not fully understanding the \[code\]FLOOR\[/code\] function?
 
Back
Top