るりまサーチ

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

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils rm_r
  5. fileutils cp_r

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 ... > >>

Numeric#imaginary -> 0 (6108.0)

常に 0 を返します。

...常に 0 を返します。

//emlist[例][ruby]{
12.imag # => 0
-12.imag # => 0
1.2.imag # => 0
-1.2.imag # => 0
//}

Numeric
のサブクラスは、このメソッドを適切に再定義しなければなりません。

@
see Numeric#real、Complex#imag...

Numeric#integer? -> bool (6108.0)

自身が Integer かそのサブクラスのインスタンスの場合にtrue を返し ます。そうでない場合に false を返します。

...ger かそのサブクラスのインスタンスの場合にtrue を返し
ます。そうでない場合に false を返します。

Numeric
のサブクラスは、このメソッドを適切に再定義しなければなりません。

//emlist[例][ruby]{
(1.0).integer? #=> false
(1).integer?...
...#=> true
//}

@
see Numeric#real?...

Numeric#nonzero? -> self | nil (6108.0)

自身がゼロの時 nil を返し、非ゼロの時 self を返します。

...ロの時 nil を返し、非ゼロの時 self を返します。

//emlist[例][ruby]{
p 10.nonzero? #=> 10
p 0.nonzero? #=> nil
p 0.0.nonzero? #=> nil
p Rational(0, 2).nonzero? #=> nil
//}

非ゼロの時に self を返すため、自身が 0 の時に他...
...理をさせたい場合に以
下のように記述する事もできます。

//emlist[例][ruby]{
a = %w( z Bb bB bb BB a aA Aa AA A )
b = a.sort {|a,b| (a.downcase <=> b.downcase).nonzero? || a <=> b }
b #=> ["A", "a", "AA", "Aa", "aA", "BB", "Bb", "bB", "bb", "z"]
//}

@
see Numeric#zero?...

Numeric#polar -> [Numeric, Numeric] (6108.0)

自身の絶対値と偏角を配列にして返します。正の数なら [self, 0]、負の数な ら [-self, Math::PI] を返します。

...します。

//emlist[例][ruby]{
1.0.polar # => [1.0, 0]
2.0.polar # => [2.0, 0]
-1.0.polar # => [1.0, 3.141592653589793]
-2.0.polar # => [2.0, 3.141592653589793]
//}

Numeric
のサブクラスは、このメソッドを適切に再定義しなければなりません。

@
see Complex#polar...

Numeric#real -> Numeric (6108.0)

自身を返します。

...す。

Numeric
のサブクラスは、このメソッドを適切に再定義しなければなりません。

//emlist[例][ruby]{
10.real # => 10
-10.real # => -10
0.1.real # => 0.1
R
ational(2, 3).real # => (2/3)
//}

@
see Numeric#imag、Complex#real...

絞り込み条件を変える

Numeric#real? -> bool (6108.0)

常に true を返します。(Complex またはそのサブクラスではないことを意味します。)

...true を返します。(Complex またはそのサブクラスではないことを意味します。)

Numeric
のサブクラスは、このメソッドを適切に再定義しなければなりません。

//emlist[例][ruby]{
10.real? # => true
-10.real? # => true
0....
...1.real? # => true
R
ational(2, 3).real? # => true
//}

@
see Numeric#integer?、Complex#real?...

Numeric#rect -> [Numeric, Numeric] (6108.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] (6108.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#round -> Integer (6108.0)

自身ともっとも近い整数を返します。

...0.5, -0.5 はそれぞれ 1,-1 に切り上げされます。いわゆる四捨五入ですが、偶数丸めではありません。

//emlist[例][ruby]{
1.round #=> 1
1.2.round #=> 1
(-1.2).round #=> -1
(-1.5).round #=> -2
//}

@
see Numeric#ceil, Numeric#floor, Numeric#truncate...
<< < 1 2 3 4 ... > >>