[gimp] R5RS compatibility fix for the modulo procedure (SourceForge bug #3395547)



commit 15747002157959d697069ad7d3c0c813d30b3e0e
Author: Kevin Cozens <kcozens svn gnome org>
Date:   Mon Aug 29 12:39:24 2011 -0400

    R5RS compatibility fix for the modulo procedure (SourceForge bug #3395547)

 plug-ins/script-fu/tinyscheme/scheme.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/plug-ins/script-fu/tinyscheme/scheme.c b/plug-ins/script-fu/tinyscheme/scheme.c
index d9aa2cd..1af760d 100644
--- a/plug-ins/script-fu/tinyscheme/scheme.c
+++ b/plug-ins/script-fu/tinyscheme/scheme.c
@@ -517,15 +517,8 @@ static num num_mod(num a, num b) {
  e2=num_ivalue(b);
  res=e1%e2;
  /* modulo should have same sign as second operand */
- if (res > 0) {
-     if (e2 < 0) {
-          res*=-1L;
-     }
- } else {
-     if (e2 > 0) {
-          res*=-1L;
-     }
- }
+ if (res * e2 < 0) {
+   res+=e2;
  ret.value.ivalue=res;
  return ret;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]