[gimp] Fix scheme for (integer? 7.0) which should return #t



commit cfde98394cd646197794871f0a6bdbdd8f256b9a
Author: Mukund Sivaraman <muks banu com>
Date:   Sat Nov 20 12:38:58 2010 +0530

    Fix scheme for (integer? 7.0) which should return #t

 plug-ins/script-fu/tinyscheme/scheme.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/script-fu/tinyscheme/scheme.c b/plug-ins/script-fu/tinyscheme/scheme.c
index c55d1ef..b46bb7a 100644
--- a/plug-ins/script-fu/tinyscheme/scheme.c
+++ b/plug-ins/script-fu/tinyscheme/scheme.c
@@ -3783,7 +3783,14 @@ static pointer opexe_3(scheme *sc, enum scheme_opcodes op) {
      case OP_STRINGP:     /* string? */
           s_retbool(is_string(car(sc->args)));
      case OP_INTEGERP:     /* integer? */
-          s_retbool(is_number(car(sc->args)) && is_integer(car(sc->args)));
+          x = car(sc->args);
+          if (!is_number(x))
+               s_retbool(0);
+          if (is_real(x)) {
+               double r = rvalue(x);
+               s_retbool(r == round_per_R5RS(r));
+          }
+          s_retbool(is_integer(x));
      case OP_REALP:     /* real? */
           s_retbool(is_number(car(sc->args))); /* All numbers are real */
      case OP_CHARP:     /* char? */



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