And I don't understand why it occurs in this case (and I don't particularly like it, either).
Here's the code
[Bradley-Luciers-MacBook-Pro:~/Downloads] lucier% cat nan-test.scm (declare (standard-bindings) (extended-bindings) (block) ;; (not safe) (not constant-fold))
(define infinity (fl/ 1.0 0.0)) (define nan1 (fl- infinity infinity)) (define nan2 (fl/ 0. 0.)) (pp (eqv? nan1 nan2))
And here's the compile command, and the run commands:
[Bradley-Luciers-MacBook-Pro:~/Downloads] lucier% gsc -keep-c -expansion nan-test.scm Expansion:
(define infinity (if (and ('#<procedure #2 ##flonum?> 0.) ('#<procedure #2 ##flonum?> 1.)) ('#<procedure #3 ##fl/> 1. 0.) ('#<procedure #4 fl/> 1. 0.)))
(define nan1 (if (and ('#<procedure #2 ##flonum?> infinity) ('#<procedure #2 ##flonum?> infinity)) ('#<procedure #5 ##fl-> infinity infinity) ('#<procedure #6 fl-> infinity infinity)))
(define nan2 (if (and ('#<procedure #2 ##flonum?> 0.) ('#<procedure #2 ##flonum?> 0.)) ('#<procedure #3 ##fl/> 0. 0.) ('#<procedure #4 fl/> 0. 0.)))
(pp (or ('#<procedure #7 ##eq?> nan1 nan2) (and ('#<procedure #8 ##subtyped?> nan1) (and ('#<procedure #8 ##subtyped?> nan2) (and ('#<procedure #9 ##fx=> ('#<procedure #10 ##subtype> nan1) ('#<procedure #10 ##subtype> nan2)) ('#<procedure #11 eqv?> nan1 nan2))))))
[Bradley-Luciers-MacBook-Pro:~/Downloads] lucier% gsi nan-test #f [Bradley-Luciers-MacBook-Pro:~/Downloads] lucier% gsi nan-test.scm #t