DOUBLE PRECISION (8-byte double-precision float)

Last updated: 2026-11-04

DOUBLE PRECISION (8-byte double-precision float)

DOUBLE PRECISION matches C's double: 8 bytes with 53 mantissa bits, about 15 to 16 decimal digits of significance, and it is PostgreSQL's default floating-point type. Written as FLOAT(p), p ranges from 1 to 53: p ≤ 24 maps to REAL and p ≥ 25 maps to DOUBLE PRECISION. It is far more precise than REAL, yet it remains binary floating point and still cannot represent 0.1 exactly.

Kindtype
Example LanguageSQL

📝 Syntax

DOUBLE PRECISION  |  FLOAT8  |  FLOAT
FLOAT(p)  ——  p from 1 to 53: p ≤ 24 means REAL, p ≥ 25 means DOUBLE PRECISION

Returns:Holds an 8-byte double-precision float. Decimal values are converted to their nearest binary approximation, so summing rows can surface tails such as 0.30000000000000004; compare with a tolerance rather than equality.

▶ Example

Runs real PostgreSQL 18 right in your browser (PGlite WASM, nothing to install). Press ▶ Run and the result appears in the panel below.

Output:

 id |       ratio        |     col_type     | exact_equal
----+--------------------+------------------+-------------
  1 |                0.1 | double precision | f
  2 | 0.3333333333333333 | double precision | f

📌 Key Points

More case studies coming soon.

📚 Related Reference

❓ FAQ

QAre FLOAT and DOUBLE PRECISION the same?
AFLOAT without a precision argument is DOUBLE PRECISION. With one, p must be below 54, otherwise you get "precision for type float must be less than 54 bits"; below 1 you get "precision for type float must be at least 1 bit".
QHow should floating-point values be compared?
ACompare with a tolerance: WHERE abs(a - b) < 0.0000001, or switch to NUMERIC for exact comparisons. Comparing floats with = is common but unreliable.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

Content reviewed by MOTO · Found an error? Report it

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏