https://bugzilla.redhat.com/show_bug.cgi?id=873385
Bug ID: 873385
QA Contact: extras-qa(a)fedoraproject.org
Severity: unspecified
Version: 17
Priority: unspecified
CC: haskell-devel(a)lists.fedoraproject.org,
petersen(a)redhat.com
Assignee: petersen(a)redhat.com
Summary: Random module fails on Doubles because of odd minBound
behaviour
Regression: ---
Story Points: ---
Classification: Fedora
OS: Unspecified
Reporter: imc(a)cs.ox.ac.uk
Type: Bug
Documentation: ---
Hardware: Unspecified
Mount Type: ---
Status: NEW
Component: hugs98
Product: Fedora
I'm not sure how live this project is any more, but here goes...
$ rpm -q hugs98
hugs98-2006.09-11.fc17.x86_64
$ hugs
Type :? for help
Hugs> :load Random
Random> randomR (1::Double,10) (mkStdGen 3)
(
Program error: arithmetic overflow
The equivalent answer in ghci is:
(1.928919588914141,2109513658 1655838864)
This seems to happen because:
Random> minBound::Int
-2147483648
Random> toInteger (minBound::Int)
-18446744071562067968
Random> toInteger (maxBound::Int)
2147483647
The implementation of Random on Doubles uses the construction
"toInteger (minBound::Int)" to get an integer random number, but
the implementation of Random on integers falls over on values
greater than 2^32-1.
--
You are receiving this mail because:
You are on the CC list for the bug.