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