Sha256: c24240fb4f168ba68edb0572fc8a5377e0961f8f1a92e8d0a57f95d15357d386
Contents?: true
Size: 428 Bytes
Versions: 270
Compression:
Stored size: 428 Bytes
Contents
class Float alias precisionless_round round private :precisionless_round # Rounds the float with the specified precision. # # x = 1.337 # x.round # => 1 # x.round(1) # => 1.3 # x.round(2) # => 1.34 def round(precision = nil) if precision magnitude = 10.0 ** precision (self * magnitude).round / magnitude else precisionless_round end end end if RUBY_VERSION < '1.9'
Version data entries
270 entries across 226 versions & 25 rubygems