CBRT

Compute the real cube root of a numeric expression, including negative values.

Category: mathReturns: DOUBLEDialect: Standard

Syntax

CBRT(expr)

Description

## Overview Returns the real cube root of the input. Unlike SQRT, CBRT accepts negative inputs because every real number has a unique real cube root. CBRT(-8) is -2, not NULL. CBRT appears in physical-unit conversions (converting volume to equivalent side length), in regression and feature engineering as a signed power transform for heavy-tailed data, and in scientific formulas such as Cardano's method for cubic equations. ## Behavior - Domain: all finite DOUBLE values, positive or negative. - Range: all real numbers. - Returns NULL if the argument is NULL. - Is anti-symmetric: CBRT(-x) = -CBRT(x). - CBRT of an exact perfect cube (1, 8, 27, 64, 125, -8, -27, ...) returns an exact integer in floating-point. ## Numeric precision - Uses the IEEE 754 double-precision cbrt routine, accurate to within one ULP. - More accurate than POW(x, 1.0/3.0) for negative x, which may return NaN because 1.0/3.0 is not an exact fraction and POW follows complex-valued semantics for non-integer exponents of negative bases. - Preserves precision well across the full DOUBLE range. ## Compatibility - Conforms to the SQL standard definition of CBRT as a scalar DOUBLE function with unrestricted domain. - Matches typical mathematical library implementations.

Parameters

NameTypeDescription
exprSpecifies the real-valued input. Accepts any finite DOUBLE value, including negative values; the cube root of a negative number is the negative of the cube root of its absolute value.

Examples

-- Basic literal: cube root of 27
SELECT CBRT(27);
-- Result: 3.0
-- Cube root of 8
SELECT CBRT(8);
-- Result: 2.0
-- Cube root of a negative number
SELECT CBRT(-64);
-- Result: -4.0
-- Cube root of zero
SELECT CBRT(0);
-- Result: 0.0
-- Identity: CBRT(x) equals POW(x, 1.0/3.0) for positive x
SELECT CBRT(125), POW(125, 1.0/3.0);
-- Result: 5.0, 4.999999999999999
-- Column use: convert volume to equivalent side length of a cube
SELECT container_id, CBRT(volume_l) AS equivalent_side_cm
FROM logistics.inventory.containers;

Pitfalls

See Also

Open in interactive docs →   DeltaForge home →