[gimp/soc-2010-cage-2] 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/soc-2010-cage-2] Fix scheme for (integer? 7.0) which should return #t
- Date: Thu, 30 Dec 2010 18:11:21 +0000 (UTC)
commit 8b5196f36976a3251d64766122cc8bb090a6a3e7
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]