Project

General

Profile

Actions

Bug #1854

closed

Random#float Should Reject Infinity and NaN as Upper Limits

Added by runpaint (Run Paint Run Run) almost 15 years ago. Updated about 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-08-01 trunk 24343) [i686-linux]
Backport:
[ruby-core:24651]

Description

=begin
Random#float happily accepts Infinity and NaN as arguments. It should reject them for three reasons:

  • Accepting an argument of Infinity implies that the value returned will be between 0.0 and Infinity, when in fact Infinity is always returned.
  • If Infinity or NaN were given by mistake the method would function without error despite not even being pseudo random. That is very dangerous.
  • NaN is meaningless as maximum value.
    =end
Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 15 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r24347.
=end

Actions

Also available in: Atom PDF

Like0
Like0