From: Christophe CURIS <[email protected]> There is a dedicaded floating point modulo operator that does a better job (faster, no precision loss), so we use it instead of the complicated formula that uses type conversions.
Signed-off-by: Christophe CURIS <[email protected]> --- wrlib/rotate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wrlib/rotate.c b/wrlib/rotate.c index d296815..f04b95e 100644 --- a/wrlib/rotate.c +++ b/wrlib/rotate.c @@ -52,7 +52,9 @@ RImage *RRotateImage(RImage * image, float angle) */ static const float min_usable_angle = 0.00699; - angle = ((int)angle % 360) + (angle - (int)angle); + angle = fmod(angle, 360.0); + if (angle < 0.0) + angle += 360.0; if (angle < min_usable_angle) { /* Rotate by 0 degree */ -- 1.7.10.4 -- To unsubscribe, send mail to [email protected].
