From 513d0dfc8a61aad4355097da5d969fbe44390a6c Mon Sep 17 00:00:00 2001 From: Shafrazi Date: Mon, 26 Nov 2018 08:38:06 +0530 Subject: [PATCH] Added to_f and abs methods (#27142) --- .../english/ruby/ruby-numbers-methods/index.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/guide/english/ruby/ruby-numbers-methods/index.md b/guide/english/ruby/ruby-numbers-methods/index.md index 5eaf395954..6a4b58be6b 100644 --- a/guide/english/ruby/ruby-numbers-methods/index.md +++ b/guide/english/ruby/ruby-numbers-methods/index.md @@ -60,6 +60,23 @@ Using `.to_s` on a number (To Float: + +Converts an Integer to a Float. + +```Ruby + 15.to_f #=> 15.0 +``` + +## Absolute value: + +Returns the absolute value of the integer. + +```Ruby + -12345.abs #=> 12345 + 12345.abs #=> 12345 +``` + ## Greatest Common Denominator: The `.gcd` method provides the greatest common divisor (always positive) of two numbers. Returns an **integer**.