COMPARE

Syntax

COMPARE( left, right, epsilon )

Description

Returns:

  • 0 if left and right differs by not more than epsilon.
  • -1 if left is less than right by more than epsilon.
  • 1 if left is greater than right by more than epsilon.

Argument types:

  • leftFractional number | Integer
  • rightFractional number | Integer
  • epsilonFractional 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 19.13.

Previous
Next