Ruby: Numeric

integer

  • 200.abs is the absolute value.
  • 200.next return the next integer.
  • leading sign: 0 for octal, 0x for hex, ob for binary
  • underscore: underscore chars are ignored in digit

float

  • 123.45.round follow the round rule
  • 123.45.ceil means rounding up
  • 123.54.floor means rounding down
  • 123.54.to_i same as rounding down

你可能感兴趣的:(Ruby: Numeric)