This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Ticket 371: Fix broken definition of expt

2012-03-29 23:20:01
WG1 - Core
alexshinn
major
cowan
duplicate
source
closed
2012-03-29 04:47:47
defect

R6RS says:

  1. 0z is 1.0 if z = 0.0, and 0.0 if (real-part z) is positive. For other cases in which the first argument is zero, either an exception is raised with condition type &implementation-restriction, or an unspecified number object is returned.

R5RS specifies behavior that is simply incorrect for z with negative real part: 0z is 1 if z = 0 and 0 otherwise.

I tested the usual suite on (expt 0.0 0.0) (expt 0.0 2), and (expt 0.0 -2):

Conforming implementations:

Racket, Gauche, Gambit, Chicken (with and without the numbers egg), Bigloo, Kawa, Chibi, Chez, SCM, Ikarus/Vicare, Ypsilon, Mosh, NexJ, STklos, KSi, RScheme, XLisp, Rep, VX, SXM, Spark, Inlab return 1.0, 0.0, and +inf.0.

Guile, Larceny return 1.0, 0.0, and +nan.0.

SISC, IronScheme, Elk return 1.0, 0.0, and 0.0.

UMB returns 1.0, 0.0, and an exception.

Non-conforming implementations:

Scheme48, BDC return an exception, 0.0, and +inf.0.

Scsh returns -nan.0, 0.0, and an exception.

Scheme 7 returns 0.0, 0.0, and an exception.

Scheme 9 returns exact 0, 0.0, and +nan.0.

Elk returns exact 1, exact 0, and exact 0.

MIT returns an exception, 0.0, and another exception.

SigScheme, Shoe, TinyScheme, Dream, Schemik, Oaklisp, Owl Lisp don't support inexact expt.

descriptionR6RS says: 0.0^z^ is 1.0 if z = 0.0, and 0.0 if (real-part z) is positive. For other cases in which the first argument is zero, either an exception is raised with condition type &implementation-restriction, or an unspecified number object is returned. R5RS specifies behavior that is simply incorrect for z with negative real part: 0^z is 1 if z = 0 and 0 otherwise.\ I tested the usual suite on `(expt 0.0 0.0)` `(expt 0.0 2)`, and `(expt 0.0 -2)`: Conforming implementations: Racket, Gauche, Gambit, Chicken (with and without the numbers egg), Bigloo, Kawa, Chibi, Chez, SCM, !Ikarus/Vicare, Ypsilon, Mosh, NexJ, STklos, KSi, RScheme, XLisp, Rep, VX, SXM, Spark, Inlab return `1.0`, `0.0`, and `+inf.0`. Guile, Larceny return `1.0`, `0.0`, and `+nan.0`. SISC, !IronScheme, Elk return `1.0`, `0.0`, and `0.0`. UMB returns `1.0`, `0.0`, and an exception. Non-conforming implementations: Scheme48, BDC return an exception, `0.0`, and `+inf.0`. Scsh returns `-nan.0`, `0.0`, and an exception. Scheme 7 returns `0.0`, `0.0`, and an exception. Scheme 9 returns exact `0`, `0.0`, and `+nan.0`. Elk returns exact `1`, exact `0`, and exact `0`. !SigScheme, Shoe, !TinyScheme, Dream, Schemik, Oaklisp, Owl Lisp don't support inexact `expt`. I still don't know how to turn off floating-point traps in MIT. R6RS says: 0.0^z^ is 1.0 if z = 0.0, and 0.0 if (real-part z) is positive. For other cases in which the first argument is zero, either an exception is raised with condition type &implementation-restriction, or an unspecified number object is returned. R5RS specifies behavior that is simply incorrect for z with negative real part: 0^z^ is 1 if z = 0 and 0 otherwise. I tested the usual suite on `(expt 0.0 0.0)` `(expt 0.0 2)`, and `(expt 0.0 -2)`: Conforming implementations: Racket, Gauche, Gambit, Chicken (with and without the numbers egg), Bigloo, Kawa, Chibi, Chez, SCM, !Ikarus/Vicare, Ypsilon, Mosh, NexJ, STklos, KSi, RScheme, XLisp, Rep, VX, SXM, Spark, Inlab return `1.0`, `0.0`, and `+inf.0`. Guile, Larceny return `1.0`, `0.0`, and `+nan.0`. SISC, !IronScheme, Elk return `1.0`, `0.0`, and `0.0`. UMB returns `1.0`, `0.0`, and an exception. Non-conforming implementations: Scheme48, BDC return an exception, `0.0`, and `+inf.0`. Scsh returns `-nan.0`, `0.0`, and an exception. Scheme 7 returns `0.0`, `0.0`, and an exception. Scheme 9 returns exact `0`, `0.0`, and `+nan.0`. Elk returns exact `1`, exact `0`, and exact `0`. !SigScheme, Shoe, !TinyScheme, Dream, Schemik, Oaklisp, Owl Lisp don't support inexact `expt`. I still don't know how to turn off floating-point traps in MIT.
descriptionR6RS says: 0.0^z^ is 1.0 if z = 0.0, and 0.0 if (real-part z) is positive. For other cases in which the first argument is zero, either an exception is raised with condition type &implementation-restriction, or an unspecified number object is returned. R5RS specifies behavior that is simply incorrect for z with negative real part: 0^z^ is 1 if z = 0 and 0 otherwise. I tested the usual suite on `(expt 0.0 0.0)` `(expt 0.0 2)`, and `(expt 0.0 -2)`: Conforming implementations: Racket, Gauche, Gambit, Chicken (with and without the numbers egg), Bigloo, Kawa, Chibi, Chez, SCM, !Ikarus/Vicare, Ypsilon, Mosh, NexJ, STklos, KSi, RScheme, XLisp, Rep, VX, SXM, Spark, Inlab return `1.0`, `0.0`, and `+inf.0`. Guile, Larceny return `1.0`, `0.0`, and `+nan.0`. SISC, !IronScheme, Elk return `1.0`, `0.0`, and `0.0`. UMB returns `1.0`, `0.0`, and an exception. Non-conforming implementations: Scheme48, BDC return an exception, `0.0`, and `+inf.0`. Scsh returns `-nan.0`, `0.0`, and an exception. Scheme 7 returns `0.0`, `0.0`, and an exception. Scheme 9 returns exact `0`, `0.0`, and `+nan.0`. Elk returns exact `1`, exact `0`, and exact `0`. !SigScheme, Shoe, !TinyScheme, Dream, Schemik, Oaklisp, Owl Lisp don't support inexact `expt`. I still don't know how to turn off floating-point traps in MIT. R6RS says: 0.0^z^ is 1.0 if z = 0.0, and 0.0 if (real-part z) is positive. For other cases in which the first argument is zero, either an exception is raised with condition type &implementation-restriction, or an unspecified number object is returned. R5RS specifies behavior that is simply incorrect for z with negative real part: 0^z^ is 1 if z = 0 and 0 otherwise. I tested the usual suite on `(expt 0.0 0.0)` `(expt 0.0 2)`, and `(expt 0.0 -2)`: Conforming implementations: Racket, Gauche, Gambit, Chicken (with and without the numbers egg), Bigloo, Kawa, Chibi, Chez, SCM, !Ikarus/Vicare, Ypsilon, Mosh, NexJ, STklos, KSi, RScheme, XLisp, Rep, VX, SXM, Spark, Inlab return `1.0`, `0.0`, and `+inf.0`. Guile, Larceny return `1.0`, `0.0`, and `+nan.0`. SISC, !IronScheme, Elk return `1.0`, `0.0`, and `0.0`. UMB returns `1.0`, `0.0`, and an exception. Non-conforming implementations: Scheme48, BDC return an exception, `0.0`, and `+inf.0`. Scsh returns `-nan.0`, `0.0`, and an exception. Scheme 7 returns `0.0`, `0.0`, and an exception. Scheme 9 returns exact `0`, `0.0`, and `+nan.0`. Elk returns exact `1`, exact `0`, and exact `0`. MIT returns an exception, `0.0`, and another exception. !SigScheme, Shoe, !TinyScheme, Dream, Schemik, Oaklisp, Owl Lisp don't support inexact `expt`.
resolutionduplicate
statusnewclosed

I'm closing this ticket, because R7RS already has this change.