るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.009秒)
トップページ > クエリ:^[x] > 種類:クラス[x]

別のキーワード

  1. _builtin ^
  2. set ^
  3. integer ^
  4. nilclass ^
  5. trueclass ^

ライブラリ

検索結果

Numeric (7.0)

数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。

...o - - -
[] | - - o o - - -
^
| - - o o - - -
Numeric Integer Fixnum Bi...
...d
//}

また、任意桁の切上げ、切捨て、四捨五入を行うメソッドは以下のように
定義できます。

//emlist[][ruby]{
class
Numeric
def roundup(d=0)
x = 10**d
if self > 0
self.quo(x).ceil * x
else
self.quo(x).floor * x
end
end

def roun...
...>> | - o - - -
[] | - o - - -
^
| - o - - -
Numeric Integer Float Rational Complex
-...