11件ヒット
[1-11件を表示]
(0.018秒)
ライブラリ
- ビルトイン (11)
検索結果
先頭1件
-
Numeric (131.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...数値を表す抽象クラスです。Integer や Float などの数値クラス
は Numeric のサブクラスとして実装されています。
演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッ......- -
floor | o o - - o o -
gcd | - o - - - - -
Numeric Integer Fixnum Bignum Float Rational......げはceil, floor を使用して以下のように定義できます。
//emlist[例][ruby]{
if n > 0 then
n.ceil
else
n.floor
end
//}
また、任意桁の切上げ、切捨て、四捨五入を行うメソッドは以下のように
定義できます。
//emlist[][ruby]{
class Numeric
d......o
finite? | o - o - o
floor | o o o o -
Numeric Integer Float Rational Complex
--------------------------------------------------------...