SQL Server“MONEY”数据是十进制浮点还是二进制浮点? [英] Is SQL Server 'MONEY' data type a decimal floating point or binary floating point?
问题描述
我找不到任何拒绝或确认SQL Server的MONEY数据类型是十进制浮点还是二进制浮点的东西。
在描述中,说MONEY类型的范围是从-2 ^ 63到2 ^ 63 - 1,所以这意味着它应该是一个二进制的浮点数。
但是在本页面列出了MONEY的确切数字。哪一种表示MONEY可能是十进制浮点数(否则它是如何精确的?或者什么是精确的定义?)
那么如果MONEY是十进制浮点那么MONEY和DECIMAL(19,4)之间有什么区别?
如果它是一个浮点实现,它将受到与FLOAT和REAL类型相同的不准确性。请参阅浮点 wikipedia。
MONEY是定点类型。
它比DECIMAL(19,4)小一个字节,因为它的范围较小(922,337,203,685,477.5808到922,337,203,685,477.5807),而(-10 ^ 15 + 1到10 ^ 15-1)。
I couldn't find anything that rejects or confirms whether SQL Server 'MONEY' data type is a decimal floating point or binary floating point.
In the description it says that MONEY type range is from -2^63 to 2^63 - 1 so this kind of implies that it should be a binary floating point.
But on this page it lists MONEY as "exact" numeric. Which kind of suggests that MONEY might be a decimal floating point (otherwise how is it exact? or what is the definition of exact?)
Then if MONEY is a decimal floating point, then what is the difference between MONEY and DECIMAL(19,4) ?
Neither. If it were an implementation of floating point it would be subject to the same inaccuracies as FLOAT and REAL types. See Floating Point on wikipedia.
MONEY is a fixed point type.
It's one byte smaller than a DECIMAL(19,4), because it has a smaller range (922,337,203,685,477.5808 to 922,337,203,685,477.5807) as opposed to (-10^15+1 to 10^15-1).
这篇关于SQL Server“MONEY”数据是十进制浮点还是二进制浮点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!