When $a \geq 0$ and $b > 0$, the "modulo" function $\mathrm{mod}(a,b)$
can be implemented by
$$
\mathrm{mod}(a,b) = a - b\left\lfloor\frac ab\right\rfloor.
$$
Bearing in mind that $\lfloor n + x \rfloor = n + \lfloor x \rfloor$
when $n$ is an integer and that $\lfloor -x \rfloor = -\lceil x \rceil$,
the $f>1$ formula works as follows:
\begin{align}
f-\mathrm{mod}(c,f) &= f - c + f\left\lfloor\frac cf\right\rfloor, \\
\mathrm{mod}(f-\mathrm{mod}(c,f),f)
&= \left(f - c + f\left\lfloor\frac cf\right\rfloor\right)
- f \left\lfloor
\frac{\left(f - c + f\left\lfloor\frac cf\right\rfloor\right)}{f}
\right\rfloor \\
&= f - c + f\left\lfloor\frac cf\right\rfloor
- f \left\lfloor 1 - \frac cf + \left\lfloor\frac cf\right\rfloor
\right\rfloor \\
&= f - c + f\left\lfloor\frac cf\right\rfloor
- f \left(1 + \left\lfloor\frac cf\right\rfloor\right)
- f \left\lfloor -\frac cf \right\rfloor \\
&= - c - f \left\lfloor -\frac cf \right\rfloor \\
&= - c + f \left\lceil \frac cf \right\rceil, \\
\frac{c+\mathrm{mod}(f-\mathrm{mod}(c,f),f)}{f}
&= \frac{c+ \left(- c + f \left\lceil \frac cf \right\rceil\right)}{f} \\
&= \left\lceil \frac cf \right\rceil.
\end{align}
A simpler way to define $g$ is therefore
$$
g(f,c) = \begin{cases}
\left\lfloor \dfrac{c-1}{f}\right\rfloor + 1 & f<1, \\
c & f=1,\\
\left\lceil \dfrac cf \right\rceil & f>1.
\end{cases}$$
When $f = 1$,
$\left\lceil\frac cf\right\rceil = c = \left\lfloor\frac{c-1}f\right\rfloor+1.$
The $f < 1$ formula converges to this value as $f$ approaches $1$ from below,
and the $f>1$ formula converges to this value as $f$ approaches $1$ from above,
just as we should hope would occur.
But $\left\lceil\frac cf\right\rceil$ and
$\left\lfloor\frac{c-1}f\right\rfloor+1$ are not equal everywhere.
For $f > 1$, they are close:
$\left\lceil\frac cf\right\rceil - \left\lfloor\frac{c-1}f\right\rfloor+1$
is either $0$ or $1.$
But for $f < 1$ the two formulas can give very different answers.
One could view the difference between the two functions this way:
when there is a choice of two or more possible pixels from which to
get the value of the pixel at coordinate $c$,
$\left\lceil\frac cf\right\rceil$ tends to choose one at or near the "top" of the range (the largest possible coordinate) while
$\left\lfloor\frac{c-1}f\right\rfloor+1$
tends to choose one at or near the "bottom" of the range.
We could imagine some tricks using the floor function and/or absolute value applied to $f$ in some way to signal when to take the "top" coordinate and when to take the "bottom" coordinate, but I imagine that would make the formula much more complicated than it already is, even with the three cases.
It seems a much better idea to just combine the $f=1$ case with one of the others and have two cases in the definition of $g$.
The "rounded average" of the two formulas,
$$
\bar g(f,c) = \left\lfloor\frac12\left(\left\lceil\frac cf\right\rceil +
\left\lfloor\frac{c-1}f\right\rfloor\right)\right\rfloor+1,
$$
might be a reasonable compromise, as it would tend to choose the
"middle" of the range of coordinates that might be mapped to $c$.