1
0
Fork 0
mirror of https://github.com/neocities/neocities.git synced 2025-05-04 14:08:00 +02:00
neocities/ext/float.rb

13 lines
202 B
Ruby

class Float
def round_to(x)
(self * 10**x).round.to_f / 10**x
end
def ceil_to(x)
(self * 10**x).ceil.to_f / 10**x
end
def floor_to(x)
(self * 10**x).floor.to_f / 10**x
end
end