lib/polyfill/v2_4/float.rb in polyfill-1.0.1 vs lib/polyfill/v2_4/float.rb in polyfill-1.1.0
- old
+ new
@@ -1,10 +1,10 @@
module Polyfill
module V2_4
module Float
def ceil(ndigits = 0)
- ndigits = ndigits.to_int
+ ndigits = InternalUtils.to_int(ndigits)
return super() if ndigits == 0
if ndigits > 0
place = 10**ndigits
(self * place).ceil / place.to_f
@@ -13,11 +13,11 @@
(self / place).ceil * place
end
end
def floor(ndigits = 0)
- ndigits = ndigits.to_int
+ ndigits = InternalUtils.to_int(ndigits)
return super() if ndigits == 0
if ndigits > 0
place = 10**ndigits
(self * place).floor / place.to_f
@@ -26,10 +26,10 @@
(self / place).floor * place
end
end
def truncate(ndigits = 0)
- ndigits = ndigits.to_int
+ ndigits = InternalUtils.to_int(ndigits)
return super() if ndigits == 0
if ndigits > 0
place = 10**ndigits
(self * place).truncate / place.to_f