Collections:
Underflow and Overflow of FLOAT Values in SQL Server Transact-SQL
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL?
✍: FYIcenter.com
If you enter a floating number that is too big or too small for the FLOAT data type, Transact-SQL will behave as:
Tutorial exercises below show some good underflow and overflow examples:
-- Single precision underflow without warning DECLARE @x REAL; -- FLOAT(24) SET @x = 9.234568E-39; SELECT @x; ---------------------------------- 0 -- Single precision overflow error DECLARE @x REAL; -- FLOAT(24) SET @x = 9.234568E+39; ---------------------------------- Msg 232, Level 16, State 2, Line 2 Arithmetic overflow error for type real, value = 9234568000000000400000000000000000000000.000000. -- Double precision underflow with warning DECLARE @x FLOAT(53); SET @x = 9.23456789012346E-309 SELECT @x; ---------------------------------- Warning: the floating point value '9.23456789012346E-309' is too small. It will be interpreted as 0. 0 -- Double precision overflow error DECLARE @x FLOAT(53); SET @x = 9.23456789012346E+309 ---------------------------------- Msg 168, Level 15, State 1, Line 2 The floating point value '9.23456789012346E+309' is out of the range of computer representation (8 bytes).
⇒ Differences of DECIMAL and FLOAT in SQL Server
⇐ Precision and Rounding of FLOAT Values in SQL Server Transact-SQL
2017-04-19, 6875🔥, 0💬
Popular Posts:
How To Use DATEADD() Function in SQL Server Transact-SQL? DATEADD() is a very useful function for ma...
Why I Can Not Enter 0.001 Second in DATETIME values in SQL Server Transact-SQL? If you enter millise...
How To Generate Random Numbers with the RAND() Function in SQL Server Transact-SQL? Random numbers a...
How To Count Rows with the COUNT(*) Function in SQL Server? If you want to count the number of rows,...
How To Insert New Line Characters into Strings in SQL Server Transact-SQL? If you want to break a st...