Mathematics with Python and Ruby/Numbers with Ruby

From Wikibooks, open books for an open world
< Mathematics with Python and Ruby
Jump to: navigation, search

Ruby being weakly typed, it is only at the time of its first allocation that Ruby knows the type of a numeric variable. Ruby possesses 5 types of numeric objects:

  1. Integers
  2. Fractions (quotients of two integers)
  3. Real numbers (really they are decimal numbers only)
  4. Decimal numbers with many decimal places (Big_Num)
  5. and complex numbers which are not really numbers because they cannot be compared