DOUBLE PRECISION

Learn how to use the PostgreSQL DOUBLE PRECISION (float8) type for storing inexact floating-point numbers, including range, precision limits, and when to use NUMERIC instead.

5 min read · Last updated: March 2026 · Back to overview

Quick Answer

PostgreSQL DOUBLE PRECISION is an inexact, 8-byte floating-point type implementing IEEE 754. It stores values in the range 1E-307 to 1E+308 with at least 15 decimal digits of precision. Use NUMERIC instead when exact decimal representation is required.

Spin up a Postgres database in 20 seconds with Vela.

Try Vela Sandbox

PostgreSQL's DOUBLE PRECISION type (also called FLOAT8 or FLOAT) is an inexact, variable-precision numeric type implementing the IEEE 754 double-precision standard. It is best suited for scientific measurements and calculations where approximate results are acceptable.

Key characteristics

  • Storage: 8 bytes
  • Range: approximately 1E-307 to 1E+308
  • Precision: at least 15 significant decimal digits
  • Synonyms: DOUBLE PRECISION, FLOAT8, FLOAT

Basic usage: storing temperature readings

CREATE TABLE temperatures (
  id          SERIAL PRIMARY KEY,
  location    TEXT NOT NULL,
  temperature DOUBLE PRECISION
);

INSERT INTO temperatures (location, temperature)
VALUES
  ('Lab Room 1',    23.5),
  ('Server Room 1', 21.8),
  ('Server Room 2', 24.3)
RETURNING *;
id |   location    | temperature
----+---------------+-------------
 1 | Lab Room 1    |        23.5
 2 | Server Room 1 |        21.8
 3 | Server Room 2 |        24.3
SELECT AVG(temperature) FROM temperatures;
  avg
------
 23.2

The inexact nature of DOUBLE PRECISION

Because DOUBLE PRECISION uses binary floating-point, some decimal fractions cannot be stored exactly:

CREATE TABLE t (c double precision);

INSERT INTO t(c) VALUES (0.1), (0.1), (0.1);

SELECT SUM(c) FROM t;
        sum
---------------------
 0.30000000000000004

This is expected IEEE 754 behavior. For financial data, use NUMERIC instead.

Numbers outside the valid range cause an error:

INSERT INTO t(c) VALUES (1E-400);
-- ERROR: "0.000...0001" is out of range for type double precision

Production tips

  • Never use DOUBLE PRECISION for monetary values — use NUMERIC to avoid floating-point rounding errors in financial calculations.
  • Avoid equality comparisons with DOUBLE PRECISION values (WHERE temp = 23.5) — use range comparisons instead (WHERE temp BETWEEN 23.4 AND 23.6).
  • Use DOUBLE PRECISION for scientific measurements, GPS coordinates, and machine learning feature values where approximate precision is acceptable.
  • Arithmetic on DOUBLE PRECISION is significantly faster than NUMERIC, making it appropriate for analytical workloads on large datasets.

Reference: PostgreSQL documentation — Floating-Point Types.

Continue in PostgreSQL Data Types: REAL.

Related in this section: Boolean · CHAR, VARCHAR, and TEXT · NUMERIC

Frequently Asked Questions

What does "inexact" mean for DOUBLE PRECISION?

Inexact means PostgreSQL cannot represent certain decimal fractions exactly in binary floating-point. For example, 0.1 cannot be stored precisely, so SUM(0.1, 0.1, 0.1) may return 0.30000000000000004 instead of 0.3. This is a fundamental limitation of IEEE 754, not a PostgreSQL bug.

What are the aliases for DOUBLE PRECISION in PostgreSQL?

DOUBLE PRECISION, FLOAT8, and FLOAT are all synonyms in PostgreSQL. They all map to the same 8-byte IEEE 754 double-precision floating-point type.

When should I use DOUBLE PRECISION instead of NUMERIC?

Use DOUBLE PRECISION for scientific measurements, statistics, and values where approximate results are acceptable and performance matters. Use NUMERIC for monetary amounts, precise calculations, or any context where rounding errors are unacceptable.

What happens if I try to store a number outside the DOUBLE PRECISION range?

PostgreSQL raises an error: "is out of range for type double precision". The range for DOUBLE PRECISION is approximately 1E-307 to 1E+308. Numbers very close to zero (below about 1E-307) cause an underflow error.

How is DOUBLE PRECISION different from REAL in PostgreSQL?

Both are inexact floating-point types, but DOUBLE PRECISION uses 8 bytes and provides at least 15 significant decimal digits, while REAL uses 4 bytes and provides about 6 significant decimal digits. DOUBLE PRECISION has a much wider range and greater precision.