Bamboozling Arithmetic!

Your assumption that multiplying by 1cm is the same as multiplying by 1 is wrong.

What about multiplying by 1in or 1mm?

The function \pgfmathresult returns a number, not a dimension. For implementation reasons, the number 1 is stored as a length, precisely 1pt.

Therefore 3*1 is 3, but 3*1cm is 85.35823, because 1cm=28.45275pt (and then TeX’s rounding applies).


The easiest way to address this is to see what the difference between the two calculations yield for \boxOffset:

enter image description here

\documentclass{article}

\usepackage{tikz}

\begin{document}

\newcommand{\boxWidth}{6cm}
\newcommand{\boxHeight}{1cm}

\pgfmathsetmacro{\boxOffset}{\boxWidth / 2cm}%
\verb|\boxOffset| 1: \boxOffset

\pgfmathsetmacro{\boxOffset}{\boxWidth / 2cm * 1cm}%
\verb|\boxOffset| 2: \boxOffset

\end{document}

In performing the division 6cm / 2cm, tikz converts the quantities to a uniform unit of measure (pts). However, in this case with similar measurements in the division, it results in merely "striping" the measurement, yielding in 3. This is understandable. Multiplying this result by 1cm, the value is first converted to pts (there are 28.45274 pts in every cm; see \newlength{\templen} \setlength{\templen}{1cm} \the\templen), yielding the desired result (3 x 28.45274 = 85.35822), with some floating point error.

A similar argument would hold for your other calculations as lengths are converted to pts before performing the arithmetic.