るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.052秒)

別のキーワード

  1. openssl integer
  2. asn1 integer
  3. _builtin integer
  4. integer downto
  5. integer digits

ライブラリ

検索結果

Numeric (83.0)

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

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

演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッ...
...- o
Numeric Integer Fixnum Bignum Float Rational Complex
-------------------------------------------------------------------------------------------
denominator
| o o - - o...
...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
Numeric Integer Float Rational Complex
--------------------------------------------------------------------------------
denominator
| o o o o o
d...