all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 75105@debbugs.gnu.org, mattiasengdegard@gmail.com,
	monnier@iro.umontreal.ca
Subject: bug#75105: (cl-random -1.0e+INF)
Date: Wed, 25 Dec 2024 23:27:09 +0000	[thread overview]
Message-ID: <87seqb73aa.fsf@protonmail.com> (raw)

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.






                 reply	other threads:[~2024-12-25 23:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87seqb73aa.fsf@protonmail.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=75105@debbugs.gnu.org \
    --cc=mattiasengdegard@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=pipcet@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.