Operations on Integers and Real Numbers
Sign Function (sgn)
Determines whether a number is positive, zero, or negative.
sgn(x) = 1 if x > 0, 0 if x = 0, -1 if x < 0
Example: sgn(-5) = -1
Distance Function
Measures distance between two real numbers.
d(x, y) = (x - y) × sgn(x - y)
Example: d(5, 2) = 3
Absolute Value
Distance of a number from zero.
|x| = d(x, 0)
Example: |-4| = 4
Floor Function (⌊x⌋)
Greatest integer less than or equal to x.
Example: ⌊3.7⌋ = 3
Ceiling Function (⌈x⌉)
Smallest integer greater than or equal to x.
Example: ⌈3.2⌉ = 4