A step function is a piecewise function over the real numbers that is made up from a finite number of constant functions. The name comes from the resemblance of the function to a set of steps.
If you can solve a contest problem with this idea, you know it well. If not, you know exactly what to review. These are real problems from the AMC 8, AMC 12 and AIME, the national math competitions for middle and high school students, each with a worked solution on LIVE by Po-Shen Loh.
The floor function, f(x)=⌊x⌋ (also written as floor(x) or [x]), takes a real number x and returns the greatest integer less than or equal to x.
⌊2⌋=2⌊2.5⌋=2⌊2.9⌋=2⌊2.99999999⌋=2⌊−1⌋=−1⌊−1.5⌋=−2⌊−1.1⌋=−2⌊−1.00000001⌋=−2
The ceiling function, f(x)=⌈x⌉ (also written as ceil(x)), takes a real number x and returns the least integer greater than or equal to x.
The sign function takes a real number x and returns 1 if x is positive, −1 if x is negative, and 0 if x is 0. We can write it as a piecewise function like so:
f(x)=⎩⎨⎧1−10x>0x<0x=0
The nearest integer function takes a real number and returns the nearest integer. There are multiple different ways to address real numbers equidistant between integers such as 0.5,2.5, and −1.5; within computer science, these numbers are usually rounded to the nearest even integer, although they are commonly rounded up as well.