12件ヒット
[1-12件を表示]
(0.028秒)
ライブラリ
- ビルトイン (12)
検索結果
先頭1件
-
Numeric (107.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...数値を表す抽象クラスです。Integer や Float などの数値クラス
は Numeric のサブクラスとして実装されています。
演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッ......[] | - - o o - - -
^ | - - o o - - -
Numeric Integer Fixnum Bignum Float Rational Complex
-----------......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 - - -
Numeric Integer Float Rational Complex
---------------------------------------------------...