Sha256: d3101e482b6e4446c0e01d4031dec628e8971665efa88989fda075dd004f3e58

Contents?: true

Size: 316 Bytes

Versions: 21

Compression:

Stored size: 316 Bytes

Contents

unless Float.method_defined? :prev_float
  require 'backports/tools/float_integer_conversion'
  require 'backports/1.9.2/float/infinity'

  class Float
    def prev_float
      return -Float::INFINITY if self == -Float::INFINITY
      Backports.integer_to_float(Backports.float_to_integer(self)-1)
    end
  end
end

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
backports-3.7.0 lib/backports/2.2.0/float/prev_float.rb