Class: Numeric
- Inherits:
-
Object
- Object
- Numeric
- Defined in:
- lib/odds/ext/string.rb,
lib/odds/ext/numeric.rb
Instance Method Summary collapse
Instance Method Details
#abs_exp(e) ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/odds/ext/numeric.rb', line 2 def abs_exp(e) if self > 0 self**e else abs**e * -1 end end |
#to_s_perc(digits = 2) ⇒ Object
2 3 4 5 |
# File 'lib/odds/ext/string.rb', line 2 def to_s_perc(digits=2) n = self.to_f * 100.0 n.round(digits).to_s + "%" end |