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.
Source for ticket #229
cc
changetime
2012-10-09 13:47:39
component
WG1 - Core
description
For good reasons, `+nan.0` is not `=` to any other number, including itself. However, `eqv?` is about "sameness" rather than "equality". I propose that we add two clauses to the definition of `eqv?`, one saying that if both arguments are `+nan.0`, `eqv?` must return `#t`, and if one argument is `+nan.0` and the other is not, `eqv?` must return `#f`.
All of my usual test Schemes already behave this way, with these exceptions:
* MIT, scsh, SigScheme, Scheme 9 do not have non-finite numbers.
* Chicken returns `#f` if either argument is `+nan.0`.
* SISC returns `#t` if either argument is `+nan.0`.
id
229
keywords
milestone
owner
cowan
priority
major
reporter
cowan
resolution
fixed
severity
status
closed
summary
EQV? and NaN
time
2011-07-11 01:41:51
type
defect
Changes
Change at time 2012-10-09 13:47:39
author
cowan
field
comment
newvalue
oldvalue
14
raw-time
1349765259614993
ticket
229
time
2012-10-09 13:47:39
Change at time 2012-10-09 13:47:39
author
cowan
field
resolution
newvalue
fixed
oldvalue
raw-time
1349765259614993
ticket
229
time
2012-10-09 13:47:39
Change at time 2012-10-09 13:47:39
author
cowan
field
status
newvalue
closed
oldvalue
writing
raw-time
1349765259614993
ticket
229
time
2012-10-09 13:47:39
Change at time 2012-08-27 07:04:38
author
cowan
field
comment
newvalue
oldvalue
13
raw-time
1346025878529299
ticket
229
time
2012-08-27 07:04:38
Change at time 2012-08-27 07:04:38
author
cowan
field
status
newvalue
writing
oldvalue
decided
raw-time
1346025878529299
ticket
229
time
2012-08-27 07:04:38
Change at time 2012-08-25 00:27:44
author
cowan
field
_comment0
newvalue
1345829336571305
oldvalue
WG1 voted to make no change: the behavior of `eqv?` on procedures is explicitly unspecified.
raw-time
1345829264709953
ticket
229
time
2012-08-25 00:27:44
Change at time 2012-08-25 00:27:44
author
cowan
field
comment
newvalue
WG1 voted to make no change: the behavior of `eqv?` on !NaNs is explicitly unspecified.
oldvalue
12
raw-time
1345829264709953
ticket
229
time
2012-08-25 00:27:44
Change at time 2012-08-25 00:27:44
author
cowan
field
status
newvalue
decided
oldvalue
reopened
raw-time
1345829264709953
ticket
229
time
2012-08-25 00:27:44
Change at time 2012-07-15 01:19:17
author
cowan
field
comment
newvalue
oldvalue
11
raw-time
1342289957996047
ticket
229
time
2012-07-15 01:19:17
Change at time 2012-07-15 01:19:17
author
cowan
field
resolution
newvalue
oldvalue
fixed
raw-time
1342289957996047
ticket
229
time
2012-07-15 01:19:17
Change at time 2012-07-15 01:19:17
author
cowan
field
status
newvalue
reopened
oldvalue
closed
raw-time
1342289957996047
ticket
229
time
2012-07-15 01:19:17
Change at time 2012-07-15 01:19:12
author
cowan
field
comment
newvalue
Reopening yet again for conspectus on `eqv?`
oldvalue
10
raw-time
1342289952744370
ticket
229
time
2012-07-15 01:19:12
Change at time 2012-07-15 01:19:12
author
cowan
field
resolution
newvalue
fixed
oldvalue
raw-time
1342289952744370
ticket
229
time
2012-07-15 01:19:12
Change at time 2012-07-15 01:19:12
author
cowan
field
status
newvalue
closed
oldvalue
writing
raw-time
1342289952744370
ticket
229
time
2012-07-15 01:19:12
Change at time 2012-04-09 22:27:10
author
cowan
field
comment
newvalue
oldvalue
9
raw-time
1333985230351401
ticket
229
time
2012-04-09 22:27:10
Change at time 2012-04-09 22:27:10
author
cowan
field
status
newvalue
writing
oldvalue
decided
raw-time
1333985230351401
ticket
229
time
2012-04-09 22:27:10
Change at time 2012-04-09 22:13:54
author
cowan
field
comment
newvalue
The WG voted to leave the behavior of `eqv?` where both arguments are `+nan.0` explicitly undefined.
oldvalue
8
raw-time
1333984434409019
ticket
229
time
2012-04-09 22:13:54
Change at time 2012-04-09 22:13:54
author
cowan
field
status
newvalue
decided
oldvalue
reopened
raw-time
1333984434409019
ticket
229
time
2012-04-09 22:13:54
Change at time 2012-02-21 03:49:28
author
cowan
field
comment
newvalue
Per Bothner points out that on his system (Java 1.7 on Fedora), nan and nan2 actually have the ''same'' bit patterns, rendering the above experiment mostly meaningless. This makes me inclined to the R6RS semantics.
oldvalue
7
raw-time
1329767368871453
ticket
229
time
2012-02-21 03:49:28
Change at time 2011-10-08 04:28:12
author
cowan
field
comment
newvalue
We need to re-ballot this, because of the false claim that the "same" semantics that people voted for was equivalent to the R6RS semantics. Here are the new ballot positions:
Let `nan` and `nan2` contain !NaNs, possibly but not necessarily with different bit patterns implying different origins. In all cases, `(eqv? nan x)`, where x is not a NaN, is required to return `#f`, assuming that `(= nan x)` returns `#f` for any x even in R5RS.
The R5RS semantics requires `(eqv? nan nan)` and `(eqv? nan nan2)` to return `#f`.
The R6RS semantics allows `(eqv? nan nan)` and `(eqv? nan nan2)` to return either `#t` or `#f`.
The "same" semantics requires `(eqv? nan nan)` and `(eqv? nan nan2)` to return `#t`.
The "same*" semantics requires `(eqv? nan nan)` to return `#t` and allows `(eqv? nan nan2`) to return either `#t` or `#f`.
I ran the following on my usual suite of Schemes on x86 Linux:
{{{
(define nan (/ 0.0 0.0))
(define inf (/ 1.0 0.0))
(define nan2 (- inf inf))
(list (eqv? nan nan) (eqv? nan nan2))
}}}
I confirmed that `nan` and `nan2` expand to different bit patterns using Java's `Double.doubleToRawLongBits` method on the same system.
* Racket, Gambit, Guile, Kawa, SISC, Chez, SCM, Larceny, Ypsilon, Mosh, !IronScheme, STklos returned `(#t #t)`, showing that they do not distinguish between `nan` and `nan2`.
* Bigloo, Chicken, Chibi, Ikarus, KSi, Elk returned `(#t #f)`, showing that they do distinguish. Chicken complains about division by 0.0, so I used `+nan.0` and `+inf.0` literals.
* Gauche, UMB, and VX returned `(#f #f)`, following R5RS semantics.
* MIT, Scheme48/scsh, Scheme 9, Scheme 7, !SigScheme, Oaklisp complained about the divisions by 0.0, and didn't provide any obvious workarounds.
oldvalue
6
raw-time
1318022892000000
ticket
229
time
2011-10-08 04:28:12
Change at time 2011-10-08 04:28:12
author
cowan
field
resolution
newvalue
oldvalue
invalid
raw-time
1318022892000000
ticket
229
time
2011-10-08 04:28:12
Change at time 2011-10-08 04:28:12
author
cowan
field
status
newvalue
reopened
oldvalue
closed
raw-time
1318022892000000
ticket
229
time
2011-10-08 04:28:12
Change at time 2011-10-08 04:16:40
author
cowan
field
comment
newvalue
oldvalue
5
raw-time
1318022200000000
ticket
229
time
2011-10-08 04:16:40
Change at time 2011-10-08 04:16:40
author
cowan
field
resolution
newvalue
invalid
oldvalue
raw-time
1318022200000000
ticket
229
time
2011-10-08 04:16:40
Change at time 2011-10-08 04:16:40
author
cowan
field
status
newvalue
closed
oldvalue
writing
raw-time
1318022200000000
ticket
229
time
2011-10-08 04:16:40
Change at time 2011-09-11 23:29:28
author
cowan
field
comment
newvalue
oldvalue
4
raw-time
1315758568000000
ticket
229
time
2011-09-11 23:29:28
Change at time 2011-09-11 23:29:28
author
cowan
field
owner
newvalue
cowan
oldvalue
alexshinn
raw-time
1315758568000000
ticket
229
time
2011-09-11 23:29:28
Change at time 2011-09-11 23:29:28
author
cowan
field
status
newvalue
writing
oldvalue
decided
raw-time
1315758568000000
ticket
229
time
2011-09-11 23:29:28
Change at time 2011-09-11 07:46:47
author
cowan
field
comment
newvalue
WG1 accepted this proposal.
oldvalue
3
raw-time
1315702007000000
ticket
229
time
2011-09-11 07:46:47
Change at time 2011-09-11 07:46:47
author
cowan
field
resolution
newvalue
oldvalue
raw-time
1315702007000000
ticket
229
time
2011-09-11 07:46:47
Change at time 2011-09-11 07:46:47
author
cowan
field
status
newvalue
decided
oldvalue
new
raw-time
1315702007000000
ticket
229
time
2011-09-11 07:46:47
Change at time 2011-08-18 18:27:32
author
cowan
field
comment
newvalue
R6RS already requires this behavior.
oldvalue
2
raw-time
1313666852000000
ticket
229
time
2011-08-18 18:27:32
Change at time 2011-07-11 13:24:56
author
aag
field
comment
newvalue
MIT Scheme does, in fact, have non-finite numbers, depending on the floating-point error mask that is set. This isn't documented, however.
oldvalue
1
raw-time
1310365496000000
ticket
229
time
2011-07-11 13:24:56