[gambit-list] Different results in interpreted and compiled code
Bradley Lucier
lucier at math.purdue.edu
Tue Dec 6 17:13:47 EST 2011
Here's a more refined test:
heine:~/Desktop> 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 (list (##flonum.->inexact-exponential-format nan1)
(##flonum.->inexact-exponential-format nan2)))
(pp (list (##subtyped? nan1)
(##subtyped? nan2)
(fx= (##subtype nan1)
(##subtype nan2))
(let ()
(declare (not inline-primitives))
(eqv? nan1 nan2))))
(pp (eqv? nan1 nan2))
heine:~/Desktop> gsc -expansion nan-test
Expansion:
(define infinity ('#<procedure #2 ##fl/> 1. 0.))
(define nan1 ('#<procedure #3 ##fl-> infinity infinity))
(define nan2 ('#<procedure #2 ##fl/> 0. 0.))
(pp ('#<procedure #4 ##list> (##flonum.->inexact-exponential-format nan1) (##flonum.->inexact-exponential-format nan2)))
(pp ('#<procedure #4 ##list>
('#<procedure #5 ##subtyped?> nan1)
('#<procedure #5 ##subtyped?> nan2)
('#<procedure #6 ##fx=> ('#<procedure #7 ##subtype> nan1) ('#<procedure #7 ##subtype> nan2))
('#<procedure #8 eqv?> nan1 nan2)))
(pp (or ('#<procedure #9 ##eq?> nan1 nan2)
(and ('#<procedure #5 ##subtyped?> nan1)
(and ('#<procedure #5 ##subtyped?> nan2)
(and ('#<procedure #6 ##fx=> ('#<procedure #7 ##subtype> nan1) ('#<procedure #7 ##subtype> nan2)) ('#<procedure #8 eqv?> nan1 nan2))))))
heine:~/Desktop> gsi nan-test
(#(+nan.0 1023 -1) #(+nan.0 1023 1))
(#t #t #t #f)
#f
heine:~/Desktop> gsi nan-test.scm
(#(+nan.0 1023 -1) #(+nan.0 1023 -1))
(#t #t #t #t)
#t
I have no idea what's going on.
Brad
heine:~/Desktop> uname -a
Linux heine 3.0.0-13-generic #22-Ubuntu SMP Wed Nov 2 13:27:26 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
heine:~/Desktop> gsi -v
v4.6.2 20110519175028 x86_64-unknown-linux-gnu "./configure /usr/local/Gambit-C/share/config.site /usr/local/Gambit-C/etc/config.site"
More information about the Gambit-list
mailing list