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.