Search code examples
sqlnullfloating-pointnan

In the SQL standard, can floating-point columns hold NaN?


In the official SQL standard (now ISO/IEC 9075 if I'm not mistaken), can a column/attribute of a floating-point type hold NaN's as legitimate non-null values?

Notes:

  • I'm not asking about any specific DBMS.
  • Please regard the latest SQL standard version you are familiar with.
  • If you know the answer has changed between versions of the standard, do indicate this.

Solution

  • As of 2011 version of SQL standard, it cannot. There are two kinds of number types (exact and approximate) and both are defined in terms of mantissa (unscaled value) and exponent (scale). No place defined for special cases like Inf or NaN.