SQL Server弥补浮游物额外的精度? [英] SQL Server makes up extra precision for floats?

查看:170
本文介绍了SQL Server弥补浮游物额外的精度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

精确度损失是一回事,但精确度增加???

我有一个文本文件w /以下坐标:

  41.88694340165634 -87.60841369628906 

这到SQL Server Mgmt Studio表视图,结果如下:

pre $ 41.886943401656339 -87.608413696289062

我在做梦吗?这是怎么回事?



我是从记事本上粘贴的,而且是原始文本。同样的问题,如果我直接键入字符。

从哪里获得额外的精度?

根据Books-On-Line:


浮点数:与浮点数一起使用的近似数字数据类型点数字数据。 浮点数据近似;因此,数据类型范围中的所有值都不能完全表示。


重点是我的。


Precision loss is one thing, but precision gain???

I have a text file w/ the following coordinates:

41.88694340165634   -87.60841369628906

When I paste this into SQL Server Mgmt Studio table view, it results in this:

41.886943401656339  -87.608413696289062

Am I dreaming? How is this possible?

I'm pasting from notepad, and it's raw text. Same problem if I type the characters directly.

Where does sql server get the extra precision from?

解决方案

According to Books-On-Line:

Float: Approximate-number data types for use with floating point numeric data. Floating point data is approximate; therefore, not all values in the data type range can be represented exactly.

Emphasis mine.

这篇关于SQL Server弥补浮游物额外的精度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆