Skip to content

complex

Complex-number data type for PostgreSQL.

complex_contrib · Complex-number data type for PostgreSQL.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
100206complexcomplex_contrib1.0TYPEUnknownC

Usage

Sources:

complex defines a 16-byte complex-number type backed by two float8 components. Version 1.0 provides arithmetic and comparison operators, implicit casts from int4 and float8, sum, min, max, avg, and complex_pwrt(complex,int4).

CREATE EXTENSION complex;
SELECT '(1,2)'::complex + '(3,-4)'::complex;
SELECT avg(z) FROM measurements;

The SQL API defines a total ordering for <, <=, >, >=, min, and max, but complex numbers have no natural mathematical order. Inspect and test the implementation’s chosen ordering before using it for business logic or sorted indexes. Floating-point equality also inherits NaN, infinity, signed-zero, rounding, and platform concerns.

The repository has no user README or release notes. Establish accepted text syntax, power-function row semantics, divide-by-zero behavior, overflow, binary dump/restore, and PostgreSQL-major compatibility on the exact build. Use core numeric pairs or an application math library when portability and a documented numerical contract matter.

Table reader