COMPARE
Written by
Updated at June 27, 2023
Syntax
COMPARE( left, right, epsilon )
Description
Returns:
- 0 if
left
andright
differs by not more thanepsilon
. - -1 if
left
is less thanright
by more thanepsilon
. - 1 if
left
is greater thanright
by more thanepsilon
.
Argument types:
left
—Fractional number | Integer
right
—Fractional number | Integer
epsilon
—Fractional number | Integer
Return type: Integer
Examples
COMPARE(1.25, 1.26, 0.1) = 0
COMPARE(1.25, 1.26, 0.001) = -1
COMPARE(1.26, 1.25, 0.001) = 1
Data source support
ClickHouse 21.8
.