Collections:
Precision and Rounding of FLOAT Values in SQL Server Transact-SQL
How REAL and FLOAT Literal Values Are Rounded in SQL Server Transact-SQL?
✍: FYIcenter.com
By definition, FLOAT(n) should store the mantissa of the floating number in n bits. For example, FLOAT(16) should have a precision one-byte less than FLOAT(24).
However, SQL Server Transact-SQL only supports two precisions for floating numbers:
The tutorial exercise below shows you some different precision and rounding examples:
-- FLOAT(1) works like FLOAT(24) DECLARE @x FLOAT(1) SET @x = 9.234567890E+10; SELECT @x; ------------ 9.234568E+10 -- 7 digits precision -- Single precision with rounding DECLARE @x REAL; -- FLOAT(24) SET @x = 9.234567890E+10; SELECT @x; ------------ 9.234568E+10 -- 7 digits precision -- FLOAT(25) works like FLOAT(53) DECLARE @x FLOAT(25); SET @x = 9.2345678901234567890E+100; SELECT @x; --------------------- 9.23456789012346E+100 -- 15 digits precision -- Double precision with rounding DECLARE @x FLOAT(53); SET @x = 9.2345678901234567890E+100; SELECT @x; --------------------- 9.23456789012346E+100 -- 15 digits precision
In other words, Transact-SQL is not truly respecting FLOAT(n) declaration.
⇒ Underflow and Overflow of FLOAT Values in SQL Server Transact-SQL
⇐ Approximate Numeric Data Types in SQL Server Transact-SQL
2017-04-19, 10624🔥, 0💬
Popular Posts:
How To Start Instance with a Minimal Initialization Parameter File in Oracle? The sample initializat...
Where to find Oracle database server tutorials? Here is a collection of tutorials, tips and FAQs for...
What is dba.FYIcenter.com Website about? dba.FYIcenter.com is a Website for DBAs (database administr...
How To Convert Characters to Numbers in Oracle? You can convert characters to numbers by using the T...
How To Connect ASP Pages to Oracle Servers in Oracle? If you are running Windows IIS Web server and ...