るりまサーチ (Ruby 2.4.0)

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

別のキーワード

  1. numeric step
  2. _builtin numeric
  3. numeric arg
  4. numeric real

ライブラリ

クラス

キーワード

検索結果

Numeric#imag -> 0 (81433.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

Complex#imag -> Numeric (54667.0)

自身の虚部を返します。

自身の虚部を返します。

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

@see Numeric#imag

Numeric#imaginary -> 0 (45433.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#real -> Numeric (27361.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

Complex#imaginary -> Numeric (18667.0)

自身の虚部を返します。

自身の虚部を返します。

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

@see Numeric#imag

絞り込み条件を変える

Complex#abs -> Numeric (328.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.7071067811865476
//}

@see Complex#abs2

Complex#magnitude -> Numeric (328.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.7071067811865476
//}

@see Complex#abs2

Complex#abs2 -> Numeric (325.0)

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

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

以下の計算の結果を返します。

self.real ** 2 + self.imag ** 2

//emlist[例][ruby]{
Complex(1, 1).abs2 # => 2
Complex(1.0, 1.0).abs2 # => 2.0
Complex('1/2', '1/2').abs2 # => (1/2)
//}

@see Complex#abs