operations: fix "fatal error: Floating point exception".
div() expects integer arguments, and therefore any denominator less than 1.0 gets rounded to 0, hence doing a division by 0.
Instead remainder() works on double values, and anyway we only needed the remainder.
See gimp#6888 (closed).
I am not pushing this directly because I am not sure if maybe for this algorithm, one absolutely wanted the remainder of a division from the rounded values. In such a case, maybe the code should be left as-is, with just a special casing for any value < 1.0. There is actually one such exception already in the code, but it was only on period < 0.0001 (this could be changed to period < 1.0
):
if (period < 0.0001)
{
period = 1.0;
amplitude = 0.0;
}
(also the period
can be assigned another value again after this when o->tileable
is TRUE)
Anyway it looks to me just using remainder()
and doing therefore a more accurate division looks good in GIMP too.