Project

General

Profile

Bug #14350

Strange behavior for Array.min in ruby 2.5.0

Added by artofhuman (Semyon Pupkov) 8 days ago. Updated 8 days ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:84821]

Description

2.4.2

[[1, 0.0].max, 1.0].min

=> 1

2.5.0

[[1, 0.0].max, 1.0].min

=> 1.0

[[1, 0.0].max, 1.0]

=> [1, 1.0]

[1, 1.0].min

=> 1

I think it`s regression for ruby 2.5.0

Associated revisions

Revision 61766
Added by nobu (Nobuyoshi Nakada) 8 days ago

vm_insnhelper.c: search in the indexing order

  • vm_insnhelper.c (vm_opt_newarray_max, vm_opt_newarray_min): search in the indexing order, as well as usual methods. [Bug #14350]

History

#1 Updated by artofhuman (Semyon Pupkov) 8 days ago

  • Description updated (diff)

#2 [ruby-core:84823] Updated by shyouhei (Shyouhei Urabe) 8 days ago

I doubt if this behavioural change is a bug that should be fixed.

#3 [ruby-core:84827] Updated by nobu (Nobuyoshi Nakada) 8 days ago

1 is not greater than 1.0, and vice versa.
The both results are correct in this case.

But the previous behavior may be better in the case of Numeric-like objects.

#4 Updated by nobu (Nobuyoshi Nakada) 8 days ago

  • Status changed from Open to Closed

Applied in changeset trunk|r61766.


vm_insnhelper.c: search in the indexing order

  • vm_insnhelper.c (vm_opt_newarray_max, vm_opt_newarray_min): search in the indexing order, as well as usual methods. [Bug #14350]

Also available in: Atom PDF