Archive for 12:00 PM

MSSQL doesn’t (completely) support IEEE754 floating points

12:00 PM

After looking for quite a while (it is unbelievable, no?) I have to accept that Microsoft’s SQL Server 2000, 2005 and 2008 do not fully support IEEE-754 floating point numbers. Specifically NaN (Not-a-Number) and +/- Infinity are not allowed. While the 2000 Server seemingly allows such values to be inserted, but breaks badly afterwards, the newer versions disallow inserting such values. Here is the MS Connect article requesting the feature. There is also the documentation about float data and a read-between-the-lines hint in the documentation for XPath numbers. The article describing floats is very circumspect about this:

The behavior of float and real follows the IEEE 754 specification on approximate numeric data types.

[emphasis mine]

The XPath article states it clearly:

However, float(53) is not exactly IEEE 754. For example, neither NaN (Not-a-Number) nor infinity is used.

.

For completeness, here’s a little review about other DMBS’ support for NaNs and Infinity: