| Start |
|---|
| Converting a String to Integer You can use the You can also pass a base parameter to the Note that the method raises an You can also use the
|
Creating an Integer By default the notation is base 10. However, there are some other built-in notations for different bases: |
| Rounding Numbers The Floating point numbers can also be rounded down to the highest integer lower than the number with the They can also be rounded up to the lowest integer higher than the number using the |
| Even and Odd Numbers The The |
| Converting a number to a string Fixnum#to_s takes an optional base argument and represents the given number in that base: If no argument is provided, then it represents the number in base 10 |
| Rational Numbers
Other ways of creating a Rational |
Complex Numbers |
| Dividing two numbers When dividing two numbers pay attention to the type you want in return. Note that dividing two integers will invoke the integer division. If your goal is to run the float division, at least one of the parameters should be of Integer division: Float division RemarksNumbers hierarchyRuby includes several built-in classes to represent numbers: The most common are:
Note that in ruby 2.4+, |
Read Article
https://develop.horje.com/learn/1434/reference