# Interval Functions

To use these functions, the Interval Feature is required.

The interval feature provides arbitrary functions to work with intervals in a data stream and algebraic operator (+, *, -, /, ^) to perform interval addition, subtraction, multiplication, division, and exponentiation.

Example
SELECT toInterval(1.0,5.0) + toInterval(-2.0,3.0) FROM stream
=> [-1.0,8.0]
SELECT toInterval(1.0,5.0) - toInterval(-2.0,3.0) FROM stream
=> [-2.0,7.0]
SELECT toInterval(1.0,5.0) * toInterval(-2.0,3.0) FROM stream
=> [-10.0,15.0]
SELECT toInterval(1.0,5.0) / toInterval(-2.0,3.0) FROM stream
=> [-2.5,Infinity]

### Union(Interval i1, Interval i2)

Computes the union of the two intervals.

Example
SELECT union(toInterval(1.0,5.0), toInterval(-2.0,3.0)) FROM stream
=> [-2.0,5.0]

### Difference(Interval i1, Interval i2)

Computes the difference of the two intervals

Example
SELECT difference(toInterval(1.0,5.0), toInterval(-2.0,3.0)) FROM stream
=> [3.0,5.0]

### Intersection(Interval i1, Interval i2)

Computes the intersection of the two intervals

Example
SELECT intersection(toInterval(1.0,5.0), toInterval(-2.0,3.0)) FROM stream
=> [1.0,3.0]

### ToInterval(Number inf, Number sup)

Converts the given value to an interval value.

• No labels