https://bugzilla.redhat.com/show_bug.cgi?id=873385
Bug ID: 873385 QA Contact: extras-qa@fedoraproject.org Severity: unspecified Version: 17 Priority: unspecified CC: haskell-devel@lists.fedoraproject.org, petersen@redhat.com Assignee: petersen@redhat.com Summary: Random module fails on Doubles because of odd minBound behaviour Regression: --- Story Points: --- Classification: Fedora OS: Unspecified Reporter: imc@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.
https://bugzilla.redhat.com/show_bug.cgi?id=873385
--- Comment #1 from Jens Petersen petersen@redhat.com --- Ah I see. I wonder if it is a 64 bit issue?
Unfortunately hugs is pretty much dead^Wunmaintained now AFAIK.
Anyway I will try to have a look at the code later and maybe compare with the current random package and see if I can come up with a patch... of course there could be other 64bit problems lurking.
https://bugzilla.redhat.com/show_bug.cgi?id=873385
--- Comment #2 from Fedora End Of Life endoflife@fedoraproject.org --- This message is a reminder that Fedora 17 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 17. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '17'.
Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 17's end of life.
Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 17 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior to Fedora 17's end of life.
Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
https://bugzilla.redhat.com/show_bug.cgi?id=873385
Jens Petersen petersen@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|17 |19
--- Comment #3 from Jens Petersen petersen@redhat.com --- Still happening with F19
https://bugzilla.redhat.com/show_bug.cgi?id=873385
Jens Petersen petersen@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Version|19 |21
--- Comment #4 from Jens Petersen petersen@redhat.com --- And still for F21 of course.
hugs98.i686 seems okay: so installed that by hand would be a workaround perhaps.
I tested on Ubuntu amd64 and got the same error (I guess the Debian package also has this problem).
https://bugzilla.redhat.com/show_bug.cgi?id=873385
--- Comment #5 from Jens Petersen petersen@redhat.com --- (FWIW 64bit ghci gives:
Prelude> toInteger (minBound :: Int) -9223372036854775808 )
Hugs seems to be assuming Int32, but something is indeed going wildly wrong with "toInteger (minBound::Int)".
I looked at:
src/bignums.c:326:primFun(primIntToInteger) { /* Conversion :: Int -> Integer */
but I am not familiar with hugs' internals and things seems to get into deep water quickly.
BTW "toInteger (minBound + 1:: Int) -1" and "toInteger (minBound -1:: Int) +1" seem to give the expected answer.
I almost wonder if it would be better to drop 64bit arch build for hugs.
https://bugzilla.redhat.com/show_bug.cgi?id=873385
--- Comment #6 from Fedora End Of Life endoflife@fedoraproject.org --- This message is a reminder that Fedora 21 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 21. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '21'.
Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 21 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
https://bugzilla.redhat.com/show_bug.cgi?id=873385
Fedora End Of Life honza.kurik@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |CLOSED Resolution|--- |WONTFIX Last Closed| |2015-12-01 21:41:01
https://bugzilla.redhat.com/show_bug.cgi?id=873385
--- Comment #7 from Fedora End Of Life honza.kurik@gmail.com --- Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug.
Thank you for reporting this bug and we are sorry it could not be fixed.
haskell-devel@lists.stg.fedoraproject.org