[gimp] Minor R5RS compatibility fix for the expt procedure.



commit 97bf01569aae866d0772e48d08f421d455d18738
Author: Kevin Cozens <kcozens cvs gnome org>
Date:   Wed Mar 16 19:18:41 2011 -0400

    Minor R5RS compatibility fix for the expt procedure.

 plug-ins/script-fu/tinyscheme/scheme.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/script-fu/tinyscheme/scheme.c b/plug-ins/script-fu/tinyscheme/scheme.c
index b7b1823..4ff01a9 100644
--- a/plug-ins/script-fu/tinyscheme/scheme.c
+++ b/plug-ins/script-fu/tinyscheme/scheme.c
@@ -3337,6 +3337,9 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) {
           if(cdr(sc->args)==sc->NIL) {
                Error_0(sc,"expt: needs two arguments");
           } else {
+               /* This 'if' is an R5RS compatability fix. */
+               if (rvalue(x) == 0 && rvalue(y) < 0)
+                   s_return(sc, mk_real(sc, 0));
                pointer y=cadr(sc->args);
                s_return(sc, mk_real(sc, pow(rvalue(x),rvalue(y))));
           }
@@ -4996,6 +4999,7 @@ void scheme_deinit(scheme *sc) {
 
 void scheme_load_file(scheme *sc, FILE *fin)
 { scheme_load_named_file(sc,fin,0); }
+
 void scheme_load_named_file(scheme *sc, FILE *fin, const char *filename) {
   dump_stack_reset(sc);
   sc->envir = sc->global_env;



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