Class: ScoutApm::Utils::Numbers

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/utils/numbers.rb

Class Method Summary collapse

Class Method Details

.round(number, decimals) ⇒ Object

Round a float to a certain number of decimal places



6
7
8
9
10
# File 'lib/scout_apm/utils/numbers.rb', line 6

def self.round(number, decimals)
  factor = 10 ** decimals

  (number * factor).round / factor.to_f
end