Full precision output of floating point types in SQL Server Management Studio

后端 未结 3 702
北海茫月
北海茫月 2020-12-06 18:08

I have the value 1555.4899999999998 stored in a float column with default precision (53). When I do a simple select, SSMS rounds the

3条回答
  •  执念已碎
    2020-12-06 18:39

    Is there a reason you would rather use a float type than a decimal type? Floats are stored as fractions, which causes them to often be slightly innacurate when doing operations on them. This is okay when you have a graphics application where the innaccuracy is much less significant than the size of a pixel, but it's a huge issue in something like an accounting application where you're dealing with money.

    I would venture to say that the accuracy of a decimal is more important to most applications than any benefit in speed or size they would get from using a float.

提交回复
热议问题