] While playing around with scheme, I came across what appears to be a
] bug, but it might be due to my misunderstanding of scheme. You be the
] judge....
]
] Consider this bit of code:
]
] (define bug
] (lambda ()
] (let ((n 1000000000)
] (root 32768))
] (do ((delta (quotient (- root (quotient n root)) 2)
] (quotient (- root (quotient n root)) 2)))
] ((<= (abs delta) 1) root)
] (format #t "root = ~s delta = ~s~%" root delta)
] (set! root (- root delta))))))
]
]
] When I run it in STK 3.0b2 built for Solaris 2.4 (and linux as well),
] the output is something like
]
] STk> (load "bug.scm")
] STk> (bug)
] root = 32768 delta = 1125
] root = 31643 delta = -120195
] root = 151838 delta = -60061
] root = 211899 delta = -30030
] root = 241929 delta = -14978
] root = 256907 delta = -7452
] root = 264359 delta = -3726
] root = 268085 delta = -1827
] root = 269912 delta = -876
] root = 270788 delta = -438
] root = 271226 delta = -182
] ...
]
] The output from the Linux version is different but still equally wrong
] after the first output line.
]
] I would have expected the output to be something like
]
] root = 32768 delta = 1125
] root = 31643 delta = 20
] 31623
]
] (which is what I get when I run it with elk.)
]
] Can someone explain what the right answer should be?
]
] Ray
This is the same for me. I am using STk 3.0b2 compiled using gcc 2.7.2 under
Solaris 2.5 and SunOS 4.1.3 with the GNU multi-precision matematic library and I
am getting the same random results, always different one from the others (it
seems to be a good random generator :-)
The previous release I have (1.6) works fine
Giorgio
-------------------------------------------------------------------------------
Giorgio Cesana | SGS-THOMSON Microelectronics
phone +39/39/603.6006 | Central R&D - DAIS
fax +39/39/603.5820 | via C. Olivetti, 2
e-mail giorgio.cesana_at_st.com | 20041 Agrate B.za (MI) - ITALY
Received on Wed Feb 14 1996 - 06:38:31 CET
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST