Let a, b
be real numbers with b != 0
. I want to perform division with remainder of a
by b
. The result should be the unique real number r
contained in [0, |b|)
such that a = bc + r
for some (unique) integer c
.
std::fmod
yields a similar result, but it allows r
to be negative. For example, std::fmod(-.1, 1) == -.1
, but I need a function which yields 0.9
for this example.