383件ヒット
[101-200件を表示]
(0.147秒)
別のキーワード
ライブラリ
- ビルトイン (383)
キーワード
- % (12)
- <=> (12)
- angle (12)
- arg (12)
- ceil (12)
- coerce (12)
- conjugate (12)
- div (12)
- divmod (12)
- eql? (12)
- fdiv (12)
- finite? (9)
- floor (12)
- infinite? (9)
- integer? (12)
- modulo (12)
- negative? (10)
- phase (12)
- positive? (10)
- quo (12)
- rect (12)
- rectangular (12)
- remainder (12)
- round (12)
- step (93)
- truncate (12)
検索結果
先頭5件
-
Numeric
# finite? -> bool (6120.0) -
self の絶対値が有限値の場合に true を、そうでない場合に false を返します。
...値の場合に true を、そうでない場合に false を返します。
//emlist[例][ruby]{
10.finite? # => true
Rational(3).finite? # => true
Float::INFINITY.finite? # => false
Float::INFINITY.is_a?(Numeric) # => true
//}
@see Numeric#infinite?... -
Numeric
# infinite? -> nil (6120.0) -
常に nil を返します。 自身が Float かComplex、もしくはそのサブクラスのインスタンスの場合は、self の絶対値が負の無限大の場合に-1を、正の無限大の場合に1を、有限値の場合に nil を返します。
...at かComplex、もしくはそのサブクラスのインスタンスの場合は、self の絶対値が負の無限大の場合に-1を、正の無限大の場合に1を、有限値の場合に nil を返します。
//emlist[例][ruby]{
10.infinite? # => nil
(3r).infinite? # => nil
//}
@s......ee Numeric#finite?、Float#infinite?、Complex#infinite?... -
Numeric
# integer? -> bool (6120.0) -
自身が Integer かそのサブクラスのインスタンスの場合にtrue を返し ます。そうでない場合に false を返します。
...Integer かそのサブクラスのインスタンスの場合にtrue を返し
ます。そうでない場合に false を返します。
Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。
//emlist[例][ruby]{
(1.0).integer? #=> false
(1).inte......ger? #=> true
//}
@see Numeric#real?... -
Numeric
# negative? -> bool (6120.0) -
self が 0 未満の場合に true を返します。そうでない場合に false を返します。
...self が 0 未満の場合に true を返します。そうでない場合に false を返します。
//emlist[例][ruby]{
-1.negative? # => true
0.negative? # => false
1.negative? # => false
//}
@see Numeric#positive?... -
Numeric
# positive? -> bool (6120.0) -
self が 0 より大きい場合に true を返します。そうでない場合に false を返します。
...self が 0 より大きい場合に true を返します。そうでない場合に false を返します。
//emlist[例][ruby]{
1.positive? # => true
0.positive? # => false
-1.positive? # => false
//}
@see Numeric#negative?... -
Numeric
# rect -> [Numeric , Numeric] (6120.0) -
[self, 0] を返します。
...[self, 0] を返します。
//emlist[例][ruby]{
1.rect # => [1, 0]
-1.rect # => [-1, 0]
1.0.rect # => [1.0, 0]
-1.0.rect # => [-1.0, 0]
//}
Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。
@see Complex#rect... -
Numeric
# rectangular -> [Numeric , Numeric] (6120.0) -
[self, 0] を返します。
...[self, 0] を返します。
//emlist[例][ruby]{
1.rect # => [1, 0]
-1.rect # => [-1, 0]
1.0.rect # => [1.0, 0]
-1.0.rect # => [-1.0, 0]
//}
Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。
@see Complex#rect... -
Numeric
# truncate -> Integer (6120.0) -
0 から 自身までの整数で、自身にもっとも近い整数を返します。
...0 から 自身までの整数で、自身にもっとも近い整数を返します。
//emlist[例][ruby]{
1.truncate #=> 1
1.2.truncate #=> 1
(-1.2).truncate #=> -1
(-1.5).truncate #=> -1
//}
@see Numeric#ceil, Numeric#floor, Numeric#round... -
Numeric
# conjugate -> Numeric (3120.0) -
常に self を返します。
...自身の共役複素数(実数の場合は常に自身)を返します。
Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。
//emlist[例][ruby]{
10.conj # => 10
0.1.conj # => 0.1
(2/3r).conj # => (2/3)
//}
@see Complex#conj... -
Numeric
# coerce(other) -> [Numeric] (132.0) -
自身と other が同じクラスになるよう、自身か other を変換し [other, self] という配列にして返します。
...自身と other が同じクラスになるよう、自身か other を変換し [other, self] という配列にして返します。
デフォルトでは self と other を Float に変換して [other, self] という配列にして返します。
Numeric のサブクラスは、このメソ......Rational の coerce のソースです。other が自身の知らない数値クラスであった場合、
super を呼んでいることに注意して下さい。
//emlist[例][ruby]{
# lib/rational.rb より
def coerce(other)
if other.kind_of?(Float)
return other, self.to_f
elsif othe......r.kind_of?(Integer)
return Rational.new!(other, 1), self
else
super
end
end
//}
数値クラスの算術演算子は通常自分と演算できないクラスをオペランドとして受け
取ると coerce を使って自分とオペランドを変換した上で演算を行います...