Sha256: 1003deaf521d6fa1a9f67647bda7cce634dc2b3651212f885635e912cefa7cd8
Contents?: true
Size: 626 Bytes
Versions: 3
Compression:
Stored size: 626 Bytes
Contents
# frozen_string_literal: true require_relative 'basic_numeric' module Basic101 class BasicFloat < BasicNumeric def self.from_s(s) value = s.to_f new(value) end def to_integer BasicInteger.new(@value.to_i) end def to_float self end def str BasicString.new(@value.to_s) end def or(other) to_integer.or(other) end def and(other) to_integer.and(other) end def not to_integer.not end def floor BasicInteger.new(@value.floor) end private def format '%.7g' % @value end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
basic101-1.0.2 | lib/basic101/basic_float.rb |
basic101-1.0.1 | lib/basic101/basic_float.rb |
basic101-1.0.0 | lib/basic101/basic_float.rb |