Nicola Ambrosetti
Nicola Ambrosetti

Reputation: 2705

Does my Postgres instance support IEEE 754 double precision floats?

According to the docs Postgres double precision type implements IEEE 754 : “The data types real and double precision are inexact, variable-precision numeric types. On all currently supported platforms, these types are implementations of IEEE Standard 754 for Binary Floating-Point Arithmetic (single and double precision, respectively), to the extent that the underlying processor, operating system, and compiler support it.”

My question is then how do I check that "the underlying processor, operating system, and compiler support it"? Is it somewhat common that this is not the case?

Clarification

I want to check if my specific Postgres instance is compliant. Is there some kind of test(s) that I can do running SQL queries in order to verify or disprove that?

Upvotes: 4

Views: 430

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246698

It is very common for today's computers to use IEEE 754 floating point numbers. So much so that even in the wide range of platforms supported by PostgreSQL, all do. The only way to check is to look at the specification and documentation of the hardware or software in question.

PostgreSQL uses whatever the compiler and machine provide for the C data type double. It does not implement floating point arithmetic itself.

Upvotes: 2

Related Questions