[gimp/cage: 71/130] Fix scheme for (integer? 7.0) which should return #t
- From: Michael Muré <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/cage: 71/130] Fix scheme for (integer? 7.0) which should return #t
- Date: Thu, 30 Dec 2010 17:53:57 +0000 (UTC)
commit c48ef7ffd4ebf9b60a368cfdc3486e8948900b66
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]