Minor R5RS compatibility fix for the expt procedure.

This commit is contained in:
Kevin Cozens 2011-03-16 19:18:41 -04:00
parent 5c07d3b52d
commit 97bf01569a
1 changed files with 4 additions and 0 deletions

View File

@ -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;