Sha256: d5619171ee2bd1c73cb77aa2f8cbc7be6dab63ac9521396c5100497da4ed408f

Contents?: true

Size: 318 Bytes

Versions: 17

Compression:

Stored size: 318 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

17 entries across 17 versions & 1 rubygems

Version Path
backports-3.25.0 lib/backports/2.2.0/float/prev_float.rb
backports-3.24.1 lib/backports/2.2.0/float/prev_float.rb
backports-3.24.0 lib/backports/2.2.0/float/prev_float.rb
backports-3.23.0 lib/backports/2.2.0/float/prev_float.rb
backports-3.22.1 lib/backports/2.2.0/float/prev_float.rb
backports-3.22.0 lib/backports/2.2.0/float/prev_float.rb
backports-3.21.0 lib/backports/2.2.0/float/prev_float.rb
backports-3.20.2 lib/backports/2.2.0/float/prev_float.rb
backports-3.20.1 lib/backports/2.2.0/float/prev_float.rb
backports-3.20.0 lib/backports/2.2.0/float/prev_float.rb
backports-3.19.0 lib/backports/2.2.0/float/prev_float.rb
backports-3.18.2 lib/backports/2.2.0/float/prev_float.rb
backports-3.18.1 lib/backports/2.2.0/float/prev_float.rb
backports-3.18.0 lib/backports/2.2.0/float/prev_float.rb
backports-3.17.2 lib/backports/2.2.0/float/prev_float.rb
backports-3.17.1 lib/backports/2.2.0/float/prev_float.rb
backports-3.17.0 lib/backports/2.2.0/float/prev_float.rb