gpt4 book ai didi

python - SQLAlchemy `Float` 、 `FLOAT` 、 `REAL` 之间的区别

转载 作者:行者123 更新时间:2023-12-04 11:47:42 29 4
gpt4 key购买 nike

SQLAlchemy 有三种主要的浮点数类型,Float , FLOAT , 和 REAL .这些之间的语义区别是什么?有没有什么东西可以在方言中始终映射到 32 位和 64 位浮点数?

最佳答案

概括Float是一种 SQLAlchemy 对象类型,它包含 SQL 中定义的几个浮点数,例如 FLOATREAL .FLOAT的区别或 REAL在 SQL 世界中是 FLOAT存储单精度和 double 浮点数,而 REAL只存储单精度浮点数。

细节
来自 the SQLAlchemy docs在撰写本文时:

[Float is a] type representing floating point types, such as FLOAT or REAL.


来自 here :

FLOAT[(n)]

FLOAT data type is used to store single-precision and double-precisionfloating-point numbers.

A single-precision floating-point number is a 32-bit approximation ofa real number. The number can be zero or can range from -3.402E+38 to-1.175E-37, or from 1.175E-37 to 3.402E+38. The range of n is 1 to 24. IBM DB2 internally represents the single-precision FLOAT data type asthe REAL data type.

A double-precision floating-point number is a 64-bit approximation ofa real number. The number can be zero or can range from -1.79769E+308to -2.225E-307, or from 2.225E-307 to 1.79769E+308. The range of n is25 to 53. IBM DB2 internally represents the double-precision FLOAT datatype as the DOUBLE [PRECISION] data type.

If n is not specified the default value is 53.

REAL

A single-precision floating-point number.

关于python - SQLAlchemy `Float` 、 `FLOAT` 、 `REAL` 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24434454/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com