class Numeric
Numeric
extensions to calculate round numbers.
Public Instance Methods
Conceptually, ceil is expected to apply to floating point numbers. However it can actually be applied to pretty much any Numeric
object. For example, one could ceil an Integer to the nearest kilo.
See Float#ceil_at
.
# File lib/sixarm_ruby_numeric_round/numeric.rb, line 13 def ceil_at(*args) to_f.ceil_at(*args) end
See Float#ceil_to
.
# File lib/sixarm_ruby_numeric_round/numeric.rb, line 19 def ceil_to(*args) to_f.ceil_to(*args) end
Conceptually, floor is expected to apply to floating point numbers. However it can actually be applied to pretty much any Numeric
object. For example, one could floor an Integer to the nearest kilo.
See Float#floor_at
.
# File lib/sixarm_ruby_numeric_round/numeric.rb, line 29 def floor_at(*args) to_f.floor_at(*args) end
See Float#floor_to
.
# File lib/sixarm_ruby_numeric_round/numeric.rb, line 35 def floor_to(*args) to_f.floor_to(*args) end
Conceptually, round is expected to apply to floating point numbers. However it can actually be applied to pretty much any Numeric
object. For example, one could round an Integer to the nearest kilo.
See Float#round_at
.
# File lib/sixarm_ruby_numeric_round/numeric.rb, line 45 def round_at(*args) to_f.round_at(*args) end
See Float#round_to
.
# File lib/sixarm_ruby_numeric_round/numeric.rb, line 51 def round_to(*args) to_f.round_to(*args) end
Conceptually, truncate is expected to apply to floating point numbers. However it can actually be applied to pretty much any Numeric
object. For example, one could truncate an Integer to the nearest kilo.
See Float#truncate_at
.
# File lib/sixarm_ruby_numeric_round/numeric.rb, line 61 def truncate_at(*args) to_f.truncate_at(*args) end
See Float#truncate_to
.
# File lib/sixarm_ruby_numeric_round/numeric.rb, line 67 def truncate_to(*args) to_f.truncate_to(*args) end