美文网首页
Ruby: Numeric

Ruby: Numeric

作者: bookinstock_ | 来源:发表于2017-04-27 08:56 被阅读15次

    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

          本文链接:https://www.haomeiwen.com/subject/irlgzttx.html