# [Tex/LaTex] How to draw the graph of the floor function floor(x/2)?

plot

Im confused as to how to draw some values because they take the same spot.

For example:

floor(-4/2)=-2
floor(-3/2)=-2

How do i draw it when the values are the same? I am unable to draw the circle in one end because there is another value starting at that point.

As the PostScript language has a floor function, it's easy with pst-plot:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\pagestyle{empty}
\usepackage[pdf, svgnames]{pstricks}%
\def\myfunc{x 2 div floor}
\usepackage{etoolbox}

\begin{document}

\psset{plotpoints=100, labelFontSize=\textstyle, ticksize=-2pt 2pt}
\begin{pspicture*}(-6.5,-3.8)(6.8,3.6)
\psaxes{->}(0,0)(-6.5,-3.8)(6,3.6)[$x$,-120][$y$,-140]
\uput[dl](0,0){$O$}
\psset{linecolor=VioletRed, arrows = *->}
\multido{\i =-6 + 2, \I = -4 + 1,\n = -4.01 + 2.00}{6}{%
\ifnumless{\i}{0}%
{\psline[linestyle=dashed, linecolor=black, linewidth=0.4pt, arrows=-](\i,\numexpr\i/2-1\relax)(\i, 0)}%
{\psline[linestyle=dashed, linecolor=black, linewidth=0.4pt, arrows=-](\i,\numexpr\i/2\relax)(\i, 0)}%
\psplot[linewidth=1pt]{\i}{\n}{\myfunc}}%
\end{pspicture*}

\end{document}