为什么双数据类型不包含在sql server中 [英] Why Double datatype is not included in sql server

查看:87
本文介绍了为什么双数据类型不包含在sql server中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everybody,



我知道我们可以在sql server中使用FLOAT或DECIMAL而不是DOUBLE数据类型。但我想知道为什么SQL SERVER中不包含双数据类型。这是什么原因?



感谢提前

Hello Everybody,

I know that we can use FLOAT or DECIMAL instead of DOUBLE datatype in sql server. But I want to know why double datatype is not included in SQL SERVER. What is the reason for that?

THANKS IN ADVANCE

推荐答案

简单:它定义基于的数据类型它是自己的数据存储大小,而不是它所安装的机器使用的存储单元,或者它的客户正在使用的存储单元。



想想看:有多大整数?

对于早期的C,是16位。对于现代编译器,它是32位,但通常可以使用更长的64位版本 - 但它取决于编译应用程序的机器。



对于SQL,它根据它们在数据库中占用的空间来定义它的值的大小,并允许您选择多少位的尾数,最多53位,这将存储从4个字节更改为8个字节。需要。对于较大的值,它提供DECIMAL类型,其存储大小在4到17个字节之间,允许存储更精确的值:最多38位小数!



float double 是编程语言中使用的名称(有时)允许更大的值 - 但并非总是如此,语言规范并不总是指定它的价值大。 C#做,C没有。
Simple: it defines datatypes based on it's own data storage size, not the storage units used by the machine it is installed on, or that it's clients are using.

Think about it: how big is an integer?
For early C, is was 16 bits. For a "modern" compiler, it is 32 bits, but a longer 64 bit version is often available - but it depends on the machine the application is compiled for.

For SQL, it defines the size of it's values in terms of how much space they take up in the database and allows you to select how many bits of those are mantissa up to 53 bits, which changes the storage from 4 bytes to 8 bytes as needed. For larger values, it provides the DECIMAL type, which has a variable storage size between 4 and 17 bytes, and allows a more precise value to be stored: up to 38 decimal digits!

float and double are names used within programming languages which (sometimes) allow larger values - but not always, the language specification does not always specify how "big" a value it is. C# does, C doesn't.


SQL Server中确实存在双类型(即64位浮点实数):这是float(53)数据类型。



更确切地说,数据类型float(1)到float(24)存储有4个字节(32位),而float(25)到float(53)存储有8个字节(64个)比特)。



你可以在这里找到关于float数据类型的更多信息:

float和real(Transact-SQL) [ ]
Double type (i.e. 64 bits floating point real) does exist in SQL Server : that is the float(53) datatype.

More exactly, datatype float(1) to float(24) are stored with 4 bytes (32 bits), whereas float(25) to float(53) are stored with 8 bytes (64 bits).

You can find more info on float datatype here:
float and real (Transact-SQL)[]


这篇关于为什么双数据类型不包含在sql server中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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