GNU bug report logs - #75105
(cl-random -1.0e+INF)

Previous Next

Package: emacs;

Reported by: Pip Cet <pipcet <at> protonmail.com>

Date: Wed, 25 Dec 2024 23:28:02 UTC

Severity: wishlist

Done: Pip Cet <pipcet <at> protonmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Pip Cet <pipcet <at> protonmail.com>
Subject: bug#75105: closed (Re: bug#75105: (cl-random -1.0e+INF))
Date: Fri, 20 Jun 2025 06:37:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#75105: (cl-random -1.0e+INF)

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 75105 <at> debbugs.gnu.org.

-- 
75105: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=75105
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Pip Cet <pipcet <at> protonmail.com>
To: Mattias Engdegård <mattias.engdegard <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 75105-done <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>,
 Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#75105: (cl-random -1.0e+INF)
Date: Fri, 20 Jun 2025 06:36:12 +0000
Mattias Engdegård <mattias.engdegard <at> gmail.com> writes:

> 18 feb. 2025 kl. 14.05 skrev Pip Cet <pipcet <at> protonmail.com>:
>
>> Okay for master?
>
> Looks fine.

Took me a while, but I've applied this and I'm closing the bug.

Pip


[Message part 3 (message/rfc822, inline)]
From: Pip Cet <pipcet <at> protonmail.com>
To: bug-gnu-emacs <at> gnu.org,
 Mattias Engdegård <mattiasengdegard <at> gmail.com>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: (cl-random -1.0e+INF)
Date: Wed, 25 Dec 2024 23:27:09 +0000
The current behavior of (cl-random -1.0e+INF) is to return NaN with a
probability of 1.1920928955078125e-07, and -1.0e+INF in the remaining
cases.

There are at least two reasonable things cl-random can return for a
negative argument.  cl-random implements both, returning a float with
negative sign or a nonnegative integer.

There are at least two reasonable things cl-random can do in response to
a zero argument.  cl-random implements three of them:

(cl-random 0.0) is 0.0
(cl-random -0.0) is -0.0
(cl-random 0) throws an error

While "(while (not (isnan (cl-random -1.0e+INF))))" is an interesting
benchmark, its behavior may be somewhat surprising.

As this behavior has been in place since at least 1993 (when the
function was called random*), users may rely on it, and only the
docstring should be changed.




This bug report was last modified 25 days ago.

Previous Next


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