Subject: bug#75105: closed (Re: bug#75105: (cl-random -1.0e+INF))

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 20 Jun 2025 06:37:02 +0000

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 [email-masked].

-- 
75105: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=75105
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#75105: (cl-random -1.0e+INF)
From: Pip Cet <[email-masked]>
To: Mattias Engdegård <[email-masked]>
Cc: Eli Zaretskii <[email-masked]>, [email-masked], Stefan Monnier <[email-masked]>, Stefan Kangas <[email-masked]>
Date: Fri, 20 Jun 2025 06:36:12 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Mattias Engdegård <[email-masked]> writes:

> 18 feb. 2025 kl. 14.05 skrev Pip Cet <[email-masked]>:
>
>> Okay for master?
>
> Looks fine.

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

Pip

Subject: (cl-random -1.0e+INF)
From: Pip Cet <[email-masked]>
To: [email-masked],Mattias Engdegård <[email-masked]>, Stefan Monnier <[email-masked]>
Date: Wed, 25 Dec 2024 23:27:09 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

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.