Skip to content

saturating_sub_pos()

Subtract one number from another, saturating at 0 for the minimum bound

Early access 1.8.0

The saturating_sub_pos function subtracts the second number from the first, saturating at 0 and 2,147,483,647 instead of overflowing.

The syntax is:

saturating_sub_pos(
x INT,
y INT
) RETURNS INT
NameTypeDefaultRequiredDescription
xINT-An integer for y to subtract from
yINT-An integer to subtract from x
ColumnTypeDescription
saturating_sub_posINTThe result of x - y, saturating at 0 for the minimum bound