GNU bug report logs - #9103
23.3.50; random* from cl does not support the whole range of integers

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Sun, 17 Jul 2011 04:04:01 UTC

Severity: minor

Found in versions 28.0.50, 23.3.50

To reply to this bug, email your comments to 9103 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9103; Package emacs. (Sun, 17 Jul 2011 04:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 17 Jul 2011 04:04:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.3.50; random* from cl does not support the whole range of integers
Date: Sun, 17 Jul 2011 12:03:06 +0800
As far as I can see, (random* most-positive-fixnum) only returns a 32bit
integer on 64bit Emacs. This might be an oversight given the age of
cl.el.

Leo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9103; Package emacs. (Mon, 18 Jul 2011 21:57:02 GMT) Full text and rfc822 format available.

Message #8 received at 9103 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Leo <sdl.web <at> gmail.com>
Cc: 9103 <at> debbugs.gnu.org
Subject: Re: bug#9103: 23.3.50;
	random* from cl does not support the whole range of integers
Date: Mon, 18 Jul 2011 17:56:49 -0400
Leo wrote:

> As far as I can see, (random* most-positive-fixnum) only returns a 32bit
> integer on 64bit Emacs.

Why does random* even need to exist? What can it do that plain random
cannot?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9103; Package emacs. (Mon, 18 Jul 2011 21:59:02 GMT) Full text and rfc822 format available.

Message #11 received at 9103 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Leo <sdl.web <at> gmail.com>
Cc: 9103 <at> debbugs.gnu.org
Subject: Re: bug#9103: 23.3.50;
	random* from cl does not support the whole range of integers
Date: Mon, 18 Jul 2011 17:58:36 -0400
Glenn Morris wrote:

> Why does random* even need to exist? What can it do that plain random
> cannot?

...non-integer results, it seems.





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9103; Package emacs. (Tue, 19 Jul 2011 01:22:02 GMT) Full text and rfc822 format available.

Message #14 received at 9103 <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 9103 <at> debbugs.gnu.org
Subject: Re: bug#9103: 23.3.50;
	random* from cl does not support the whole range of integers
Date: Tue, 19 Jul 2011 09:21:32 +0800
On 2011-07-19 05:58 +0800, Glenn Morris wrote:
> Glenn Morris wrote:
>
>> Why does random* even need to exist? What can it do that plain random
>> cannot?
>
> ...non-integer results, it seems.

We need to extend plain random to support random-states. I plan to do it
once the random module in gnulib is usable.

Another option is to use Mersenne Twister PRNG, which I have in my local
tree (patch: http://paste.pocoo.org/show/ZYhLUPeXlkj405100KX4/). The
files mt19937.[ch] are from its authors'. Do you know if that can be
included in Emacs?

Leo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9103; Package emacs. (Tue, 19 Jul 2011 01:30:04 GMT) Full text and rfc822 format available.

Message #17 received at 9103 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Leo <sdl.web <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 9103 <at> debbugs.gnu.org
Subject: Re: bug#9103: 23.3.50; random* from cl does not support the whole
	range of integers
Date: Tue, 19 Jul 2011 03:28:51 +0200
On Tue, Jul 19, 2011 at 03:21, Leo <sdl.web <at> gmail.com> wrote:

> The
> files mt19937.[ch] are from its authors'. Do you know if that can be
> included in Emacs?

From http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/elicense.html :

"Until 2001/4/6, MT had been distributed under GNU Public License, but
after 2001/4/6, we decided to let MT be used for any purpose,
including commercial use. 2002-versions mt19937ar.c, mt19937ar-cok.c
are considered to be usable freely."

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9103; Package emacs. (Sun, 11 Sep 2011 03:33:02 GMT) Full text and rfc822 format available.

Message #20 received at 9103 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Leo <sdl.web <at> gmail.com>, 9103 <at> debbugs.gnu.org
Subject: Re: bug#9103: 23.3.50;
	random* from cl does not support the whole range of integers
Date: Sun, 11 Sep 2011 05:20:00 +0200
Glenn Morris <rgm <at> gnu.org> writes:

> Glenn Morris wrote:
>
>> Why does random* even need to exist? What can it do that plain random
>> cannot?
>
> ...non-integer results, it seems.

`random*' ends with

(* (/ n '8388608e0) lim)

if LIM isn't an integer.  Anybody willing to hazard a guess why
8388608.0 was chosen?

And would it make sense to just replace it all with a call to `random',
and then make it into a floating point if it floats?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9103; Package emacs. (Sun, 11 Sep 2011 07:49:02 GMT) Full text and rfc822 format available.

Message #23 received at 9103 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: Glenn Morris <rgm <at> gnu.org>, Leo <sdl.web <at> gmail.com>, 9103 <at> debbugs.gnu.org
Subject: Re: bug#9103: 23.3.50;
	random* from cl does not support the whole range of integers
Date: Sun, 11 Sep 2011 09:44:28 +0200
Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:

> `random*' ends with
>
> (* (/ n '8388608e0) lim)
>
> if LIM isn't an integer.  Anybody willing to hazard a guess why
> 8388608.0 was chosen?

Because that's the range of n.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9103; Package emacs. (Thu, 19 Nov 2020 05:20:02 GMT) Full text and rfc822 format available.

Message #26 received at 9103 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Leo <sdl.web <at> gmail.com>
Cc: 9103 <at> debbugs.gnu.org
Subject: Re: bug#9103: 23.3.50; random* from cl does not support the whole
 range of integers
Date: Wed, 18 Nov 2020 21:19:36 -0800
Leo <sdl.web <at> gmail.com> writes:

> As far as I can see, (random* most-positive-fixnum) only returns a 32bit
> integer on 64bit Emacs. This might be an oversight given the age of
> cl.el.

This seems to be an issue also with cl-random on current master, AFAICT.




bug Marked as found in versions 28.0.50. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Fri, 22 Oct 2021 09:35:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9103; Package emacs. (Fri, 22 Oct 2021 15:59:02 GMT) Full text and rfc822 format available.

Message #31 received at 9103 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: Glenn Morris <rgm <at> gnu.org>, Leo <sdl.web <at> gmail.com>, 9103 <at> debbugs.gnu.org
Subject: Re: bug#9103: 23.3.50; random* from cl does not support the whole
 range of integers
Date: Fri, 22 Oct 2021 11:58:14 -0400
Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:

>> Glenn Morris wrote:
>>
>>> Why does random* even need to exist? What can it do that plain random
>>> cannot?
>>
>> ...non-integer results, it seems.

(That's `cl-random' these days.)

> and then make it into a floating point if it floats?

The Common Lisp version of `random' supports float and integer values
depending on what type its argument has.  I guess that's what
`cl-random' is based on.

I'm not sure if we can change `random' to do the same.  But if there is
a need for random floating point numbers, it does seem unfortunate that
we only have that functionality in CL-Lib.




This bug report was last modified 3 years and 233 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.