Possible alternative for finding the Area under the floor function (aka, the integral of floor(x)) So, I had to ask myself the question as to what the area under the floor function could possibly be.
I started by graphing the basic $\mbox{floor}(x)$ function (I personally use desmos.com for a nice online graphing calculator), then I plotted $y=x$. I then, I noticed that the line of best fit for the $\mbox{floor}$ function was $x-(1/2)$, or $x-0.5$. So, I decided to integrate that result with respect to $x$. So, I ended with $(x^2 -x)/2$. I have tested this out several times, and so far the numbers are accurate.
In summary:
$\mbox{floor}(x)$ has trendline $x-0.5$.
Take the antiderivative of the trendline -> $(x^2 -x)/2$.
Then find the area under the steps.
I personally took it analytically by looking at graphs and manually computing the area underneath the steps.
So, what do you guys think?
 A: Your formula $\dfrac{x^2-x}2$ works as an approximation, but it fails as an actual formula.
For example, the actual area "under" the floor function (below it and above the $x$-axis) between $x=0$ and $x=\frac 12$ is zero, but your formula gives
$$\left[\frac{x^2-x}2\right]_0^{1/2}=-\frac 18$$
Are you trying for an approximation or for an actual formula? For an actual formula, recognize the that area under the floor of $x$ (I'll call it $\lfloor x\rfloor$) is the triangular number corresponding to $\lfloor x\rfloor-1$ plus the thin rectangle under the graph which has height $\lfloor x\rfloor$ and width $x-\lfloor x\rfloor$. Therefore the area under $f(u)=\lfloor u\rfloor$ between $0$ and $x$ is
$$\int_0^x \lfloor u\rfloor\,du = \frac{\lfloor x\rfloor(\lfloor x\rfloor-1)}2+\lfloor x\rfloor(x-\lfloor x\rfloor)$$
That expression can be simplified in various ways, of course. As @DavidK points out in a comment, my expression becomes yours when $x$ is an integer: my first term becomes your expression and my second term becomes zero since $x-\lfloor x\rfloor=0$ for integral $x$. Your expression just needs a "correction" term to make it work for non-integral $x$. So this may be the best expression for your purpose (note that it shows that the maximum error of your expression is $\frac 18$):

$$\int_0^x \lfloor u\rfloor\,du = \frac{x^2-x}2+\frac{(x-\lfloor x\rfloor)-(x-\lfloor x\rfloor)^2}2$$

Here is a graph showing your expression and the corrected one.

A: Rory Daulton already gave a complete answer, but here's a slightly
different way of coming to an equivalent conclusion.
Compare the region of the plane between the $x$ axis and the
graph of the function $f_1(x) = x$.
Now do the same for the function $f_2(x) = \lfloor x \rfloor$.
The difference between the two regions is a sequence of right triangles
that lie along the line $y=x$.
If $b \geq 0$, the area of those triangles between the lines $x=0$ and $x=b$
is the difference between $\int_0^b x\,dx$ and
$\int_0^b \lfloor x \rfloor\,dx$.
That is, to compute $\int_0^x \lfloor t \rfloor\,dt$ for $x \geq 0$
(choosing the name $x$ for the upper limit of integration
so the result is more consistent with your formula, and choosing a different name for the variable of integration to avoid confusion),
you can first find $\int_0^x t\,dt$ and then subtract the area of the right triangles.
Each triangle has two legs of length $1$ and area $\frac12$, except that
if $x$ is not an integer, the last triangle will be smaller than the others:
its legs will be only $x - \lfloor x \rfloor$.
The result is
$$
\int_0^x \lfloor t \rfloor\,dt 
= \frac12 x^2 - \frac12 \lfloor x \rfloor - \frac12(x - \lfloor x \rfloor)^2,
$$
which is exactly equal to Rory Daulton's formula. (I checked it.)
