るりまサーチ

最速Rubyリファレンスマニュアル検索!
60件ヒット [1-60件を表示] (0.054秒)
トップページ > クエリ:new[x] > クエリ:raise[x] > クエリ:Complex[x]

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

種類

ライブラリ

モジュール

検索結果

NEWS for Ruby 2.7.0 (26084.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...NEWS for Ruby 2.7.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...ュメントの識別子の引用符は同じ行で閉じる必要があります。

//emlist{
<<"EOS
" # This had been warned since 2.4; Now it raises a SyntaxError
EOS
//}

* フリップフロップが非推奨になったのが元に戻されました。 5400

* 以下のような場所に...
...clamp(0..2) #=> 1
3.clamp(0..2) #=> 2
# With beginless and endless ranges:
-1.clamp(0..) #=> 0
3.clamp(..2) #=> 2
//}

* Complex
* 新規メソッド
* Complex#<=>が追加されました。
その結果、「0 <=> 0i」がNoMethodErrorを発生しなくなりました。 158...

NEWS for Ruby 2.1.0 (26048.0)

NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...NEWS for Ruby 2.1.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...付けると虚数単位 i を掛けた数になる
42i # => Complex(0, 42)
3.14i # => Complex(0, 3.14)

# ri を付けると複素数の虚部が有理数になる
42ri # => Complex(0, 42r)
3.14ri # => Complex(0, 3.14r)
//}

* def によるメソッド定義式は nil の...
...換します。

* Exception
* 追加: Exception#cause 一つ前の例外を新しい例外を返します。
例外を rescue して raise しなおしたときに元の例外が一つ前の例外としてセットされています。

* GC
* 改良: RGenGC として知られて...

1.6.8から1.8.0への変更点(まとめ) (24368.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...スのスーパークラスは同じなのだそうです
((<ruby-bugs-ja:324>))。さあっぱりわかりません(^^;;

class << Object.new
class << self.superclass
p [self.id, self]
end
class << self
p [self.superclass.id, self.supe...
...は Proc, Method オブジェクト限定でした。
これに伴い Proc#to_proc が追加されました。

: 終了ステータス [compat]

raise
SystemExit したときに終了ステータス 1 で終了するようになりました。
((<ruby-dev:16776>))

: ((<"rescue/ensure on begi...
...: ((<benchmark>)) [new]
added

: Curses [lib] [compat]

Updated. New methods and constants for using the mouse, character
attributes, colors and key codes have been added.

: Complex#to_i [lib] [obsolete]
: Complex#to_f [lib] [obsolete]
: Complex#to_r [lib]...

Kernel.#Complex(r, i = 0) -> Complex (18340.0)

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

...が r、虚部が i である Complex クラスのオブジェクトを生成します。

@param r 生成する複素数の実部。

@param i 生成する複素数の虚部。省略した場合は 0 です。

@param s 生成する複素数を表す文字列。


@raise ArgumentError 変換でき...
...生します。

//emlist[例][ruby]{
Complex
(1) # => (1+0i)
Complex
(1, 2) # => (1+2i)
Complex
('1+1i') # => (1+1i)
Complex
('1+1j') # => (1+1i)
# Complex.polar(10, 10) と同一。
Complex
('10@10') # => (-8.390715290764524-5.440211108893697i)
Complex
('_') # => ArgumentError
//}

r に...
...計算した Complex オブジェクトを返しま
す。

//emlist[例][ruby]{
Complex
('1+1i', '2+3i') # => (-2+3i)
Complex
('1+1i') + Complex('2+3i') * Complex('i') # => (-2+3i)
//}

@see Complex.rect、Complex.rectangular

[注意] Complex.newComplex.new! は 1.9 系...

Kernel.#Complex(r, i = 0, exception: true) -> Complex | nil (18340.0)

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

...実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

@param r 生成する複素数の実部。

@param i 生成する複素数の虚部。省略した場合は 0 です。

@param s 生成する複素数を表す文字列。

@param exception false を...
...す。

@raise ArgumentError 変換できないオブジェクトを指定した場合に発生します。

//emlist[例][ruby]{
Complex
(1) # => (1+0i)
Complex
(1, 2) # => (1+2i)
Complex
('1+1i') # => (1+1i)
Complex
('1+1j') # => (1+1i)
# Complex.polar(10, 10) と同一。
Complex
('10@10')...
...計算した Complex オブジェクトを返しま
す。

//emlist[例][ruby]{
Complex
('1+1i', '2+3i') # => (-2+3i)
Complex
('1+1i') + Complex('2+3i') * Complex('i') # => (-2+3i)
//}

@see Complex.rect、Complex.rectangular

[注意] Complex.newComplex.new! は 1.9 系...

絞り込み条件を変える

Kernel.#Complex(s) -> Complex (18340.0)

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

...が r、虚部が i である Complex クラスのオブジェクトを生成します。

@param r 生成する複素数の実部。

@param i 生成する複素数の虚部。省略した場合は 0 です。

@param s 生成する複素数を表す文字列。


@raise ArgumentError 変換でき...
...生します。

//emlist[例][ruby]{
Complex
(1) # => (1+0i)
Complex
(1, 2) # => (1+2i)
Complex
('1+1i') # => (1+1i)
Complex
('1+1j') # => (1+1i)
# Complex.polar(10, 10) と同一。
Complex
('10@10') # => (-8.390715290764524-5.440211108893697i)
Complex
('_') # => ArgumentError
//}

r に...
...計算した Complex オブジェクトを返しま
す。

//emlist[例][ruby]{
Complex
('1+1i', '2+3i') # => (-2+3i)
Complex
('1+1i') + Complex('2+3i') * Complex('i') # => (-2+3i)
//}

@see Complex.rect、Complex.rectangular

[注意] Complex.newComplex.new! は 1.9 系...

Kernel.#Complex(s, exception: true) -> Complex | nil (18340.0)

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

...実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

@param r 生成する複素数の実部。

@param i 生成する複素数の虚部。省略した場合は 0 です。

@param s 生成する複素数を表す文字列。

@param exception false を...
...す。

@raise ArgumentError 変換できないオブジェクトを指定した場合に発生します。

//emlist[例][ruby]{
Complex
(1) # => (1+0i)
Complex
(1, 2) # => (1+2i)
Complex
('1+1i') # => (1+1i)
Complex
('1+1j') # => (1+1i)
# Complex.polar(10, 10) と同一。
Complex
('10@10')...
...計算した Complex オブジェクトを返しま
す。

//emlist[例][ruby]{
Complex
('1+1i', '2+3i') # => (-2+3i)
Complex
('1+1i') + Complex('2+3i') * Complex('i') # => (-2+3i)
//}

@see Complex.rect、Complex.rectangular

[注意] Complex.newComplex.new! は 1.9 系...

Kernel.#Rational(x, y = 1) -> Rational (18.0)

引数を有理数(Rational)に変換した結果を返します。

...y 変換対象のオブジェクトです。省略した場合は x だけを用いて
Rational オブジェクトを作成します。


@raise ArgumentError 変換できないオブジェクトを指定した場合に発生します。

引数 x、y の両方を指定した場合、x/y...
...

//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational(1, 3) # => (1/3)
Rational("0.1", "0.3") # => (1/3)
Rational(Complex(1,2), 2) # => ((1/2)+(1/1)*i)
//}

ただし、1.8系とは異なり、Rational オブジェクトは常に既約(それ以上
約分できない...
...引数に変換できないオブジェクトを指定した場合には ArgumentError が
発生します。

//emlist[例][ruby]{
Rational(Object.new) # => ArgumentError
Rational("") # => ArgumentError
Rational(nil) # => ArgumentError
//}

また、Rational('0.3') と Rationa...

Kernel.#Rational(x, y = 1, exception: true) -> Rational | nil (18.0)

引数を有理数(Rational)に変換した結果を返します。

...exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。

@raise ArgumentError 変換できないオブジェクトを指定した場合に発生します。

引数 x、y の両方を指定した場合、x/y...
...

//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational(1, 3) # => (1/3)
Rational("0.1", "0.3") # => (1/3)
Rational(Complex(1,2), 2) # => ((1/2)+(1/1)*i)
//}

ただし、1.8系とは異なり、Rational オブジェクトは常に既約(それ以上
約分できない...
...引数に変換できないオブジェクトを指定した場合には ArgumentError が
発生します。

//emlist[例][ruby]{
Rational(Object.new) # => ArgumentError
Rational("") # => ArgumentError
Rational(nil) # => ArgumentError
//}

また、Rational('0.3') と Rationa...