[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Issue: EXPT-ZERO-ZERO (Version 1)
- To: CL-Cleanup@SAIL.Stanford.EDU
- Subject: Issue: EXPT-ZERO-ZERO (Version 1)
- From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
- Date: Mon, 27 Feb 89 19:37 EST
- Cc: Cyphers@JASPER.SCRC.Symbolics.COM
- References: <19890228000733.1.CYPHERS@SEAR.SCRC.Symbolics.COM>
References: EXPT (pp203-204)
Edit history: 27-Feb-89, Version 1 by Scott Cyphers (Cyphers@Symbolics.COM),
27-Feb-89, Version 2 by Pitman (signals->is an error, misc edits)
Status: For Internal Discussion
(expt 0 0) is mathematically undefined, but CLtL defines it as
being 1 in most cases.
Make (expt 0 0) an error for zeros of all types.
That is, it has ``undefined effect.''
(EXPT 0 0) => 1 ;according to CLtL
(EXPT 0 0) is undefined ;proposed
For some examples of the behavior of 0 , consider:
1) Lim 0 = 0
2) Y(X) = --------
c + ln X
Lim Y(X) = 0
Lim X = k
Symbolics Genera returns 1 for the test case.
Cost to Implementors:
Technically, there is no cost to implementors because this would become
an ``is an error'' situation, and all implementations that already conform
would continue to conform.
In practice, most implementations would want to detect the error in
high safety situations. In most cases, this is a straightforward change
to one or two functions, and including perhaps some compiler optimizers.
If any implementations have microcoded this operation, the change may
be more complicated.
Cost to Users:
Even though some implementations might not change, users would not be
able to depend on this feature in portable code. Given the mathematical
questionableness of the behavior, however, some of the affected users
may treat a trend toward error detection as a `bug fix.'
Cost of Non-Adoption:
Some mathematical errors will not be detected because CL supplies a
value which is not always appropriate.
In implementations which choose to reliably signal an error in this case,
condition handling can be used to customize the behavior of (expt 0 0)
in a manner appropriate to the application.
We'd really prefer one of ``must signal'' or ``should signal,'' but
since non-integer 0 powers are already ``is an error'' this is most
Cyphers, Pitman, and several other Lisp developers at Symbolics think
this is a good idea.