"There is no need to approximate 0.114 and 0.116, FLOAT(53) has enough precision for both."
That is not how these data types work. You cannot say that the more bytes you use will correspond to the ability to exactly represent a certain number of decimals.
For example, SQL Server cannot represent the value 3.1 in a float. Try below from SQLCMD.EXE and you will see that (the value returned is 3.1000000000000001, not 3.1.
SELECT CAST(3.1 AS FLOAT)
SELECT CAST(3.1 AS FLOAT(53))
Note that if you use SSMS, then the value will be rounded to 3.1, but that is the tool doing the rounding, something that SQLCMD doesn't do. I.e., SQLCMD give use the truth.
Tibor Karaszi, SQL Server MVP | web | blog
No comments:
Post a Comment