るりまサーチ

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

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

クラス

検索結果

String#to_r -> Rational (18176.0)

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

...ダースコアで繋いだ形式

//emlist[例][ruby]{
' 2 '.to_r # => (2/1)
'1/3'.to_r # => (1/3)
'-9.2'.to_r # => (-46/5)
'-9.2E2'.to_r # => (-920/1)
'1_234_567'.to_r # => (1234567/1)
'1_234/5_678'.to_r # => (617/2839)
//}

Kernel.#Rational に文字列を指定し...
...une 09'.to_r # => (21/1)
'21/06/09'.to_r # => (7/2) # 21/6 を約分して 7/2。
//}

変換できないような文字列を指定した場合は 0/1 を返します。

//emlist[][ruby]{
'foo'.to_r # => (0/1)
''.to_r # => (0/1)
'bwv 1079'.to_r # => (0/1)
//}

@
see Kern...

Rational#to_r -> Rational (18122.0)

自身を返します。

...自身を返します。

@
return 自身を返します。

//emlist[例][ruby]{
Rational(3, 4).to_r # => (3/4)
Rational(8).to_r # => (8/1)
//}...

Complex#to_r -> Rational (15128.0)

自身を Rational に変換します。

...自身を Rational に変換します。

@
param eps 許容する誤差。常に無視されます。

@
raise RangeError 虚部が実数か、0 ではない場合に発生します。

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

Complex#rationalize -> Rational (28.0)

自身を Rational に変換します。

...自身を Rational に変換します。

@
param eps 許容する誤差。常に無視されます。

@
raise RangeError 虚部が実数か、0 ではない場合に発生します。

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

Complex#rationalize(eps) -> Rational (28.0)

自身を Rational に変換します。

...自身を Rational に変換します。

@
param eps 許容する誤差。常に無視されます。

@
raise RangeError 虚部が実数か、0 ではない場合に発生します。

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

絞り込み条件を変える