
Issue #19855 has been reported by kyanagi (Kouhei Yanagita). ---------------------------------------- Bug #19855: Array#bsearch gets wrong result when its block returns a non-integer numeric value. https://bugs.ruby-lang.org/issues/19855 * Author: kyanagi (Kouhei Yanagita) * Status: Open * Priority: Normal * ruby -v: ruby 3.3.0dev (2023-08-29T04:52:18Z master c0e913ae88) [arm64-darwin22] * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- Array#bsearch gets wrong result when its block returns a non-integer numeric value. ``` % ruby -e 'p [0, 4, 7, 10, 12].bsearch { |x| (4 - x) }' 4 % ruby -e 'p [0, 4, 7, 10, 12].bsearch { |x| (4 - x).to_r }' nil ``` fix: https://github.com/ruby/ruby/pull/8314 -- https://bugs.ruby-lang.org/