るりまサーチ

最速Rubyリファレンスマニュアル検索!
150件ヒット [1-100件を表示] (0.021秒)
トップページ > クエリ:Numeric#real[x]

別のキーワード

  1. numeric step
  2. _builtin numeric
  3. numeric real
  4. numeric real?
  5. numeric ceil

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Numeric#real -> Numeric (62244.0)

自身を返します。

...す。

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

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

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

Numeric (38148.0)

数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。

...スです。Integer や Float などの数値クラス
Numeric のサブクラスとして実装されています。

演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッドは、サブクラスで...
...提供されているメソッド
(+, -, *, /, %) を利用して定義されるものがほとんどです。
つまり Numeric で定義されているメソッドは、Numeric のサブクラスとして新たに数値クラスを定義した時に、
演算メソッド(+, -, *, /, %, <=>, coerce...
...を表しメソッド定義などではこの記法を利用します。

効率のため Numeric のメソッドと同じメソッドがサブクラスで再定義されている場合があります。

Numeric
#coerce メソッドを使うことによって異なる数値クラス間で演算を...

Numeric#real? -> bool (30143.0)

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

...ます。)

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

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

@see Numeric#integer?、...

Numeric#imag -> 0 (21024.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#imaginary -> 0 (21024.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 (21024.0)

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

...スタンスの場合にtrue を返し
ます。そうでない場合に false を返します。

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

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

@see Numeric#real?...

Complex#real -> Numeric (18208.0)

自身の実部を返します。

...自身の実部を返します。

//emlist[例][ruby]{
Complex(3, 2).real # => 3
//}...

Matrix#real? -> bool (6167.0)

行列の全要素が実(Numeric#real?)であれば true を返します。

...の全要素が実(Numeric#real?)であれば true を返します。

Complexオブジェクトを要素に持つ場合は虚部が0でも偽を返します。

//emlist[例][ruby]{
require 'matrix'
Matrix[[1, 0], [0, 1]].real? # => true
Matrix[[Complex(0, 1), 0], [0, 1]].real? # => false
# 要素...
...が実数であっても Complex オブジェクトなら偽を返す。
Matrix[[Complex(1, 0), 0], [0, 1]].real? # => false
//}...

Complex#real? -> false (6131.0)

常に false を返します。

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

//emlist[例][ruby]{
(2+3i).real? # => false
(2+0i).real? # => false
//}

@see Numeric#real?...

Complex#abs -> Numeric (108.0)

自身の絶対値を返します。

...自身の絶対値を返します。

以下の計算の結果を Float オブジェクトで返します。

sqrt(self.real ** 2 + self.imag ** 2)

//emlist[例][ruby]{
Complex(1, 2).abs # => 2.23606797749979
Complex(3, 4).abs # => 5.0
Complex('1/2', '1/2').abs # => 0.70710678118...

絞り込み条件を変える

<< 1 2 > >>