all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#75105: (cl-random -1.0e+INF)
@ 2024-12-25 23:27 Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; only message in thread
From: Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-25 23:27 UTC (permalink / raw)
  To: 75105, mattiasengdegard, monnier

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.






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-25 23:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-25 23:27 bug#75105: (cl-random -1.0e+INF) Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.