In your case there is no step. Floating-point ranges cannot be repeated.
The code
(Math::PI * 6 .. Math::PI * 6.5).to_a
throws a TypeError:
TypeError: Unable to retry with Float
Your code is valid because it bsearchdoes not iterate over the range values. Instead, it “knows” the values of min and max and half the interval until it reaches the value for which the block { |f| Math.cos(f) <= 0.5 }returns true.
, puts , bsearch:
(Math::PI * 6 .. Math::PI * 6.5).bsearch { |f| puts f; Math.cos(f) <= 0.5 }