るりまサーチ (Ruby 2.5.0)

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

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. ipaddr to_i
  5. csv to_i

ライブラリ

クラス

キーワード

検索結果

BigDecimal#coerce(other) -> Array (90643.0)

self と other が同じクラスになるよう、self か other を変換し [other, self] という配列にして返します。

self と other が同じクラスになるよう、self か other を変換し [other,
self] という配列にして返します。

@param other 比較または変換するオブジェクト

BigDecimal#coerce は Ruby における強制型変換のための機能です。
BigDecimal オブジェクトとその他のオブジェクト間の各種の計算は
BigDecimal#coerce の結果を元に行われます。

//emlist[][ruby]{
require "bigdecimal"
a = BigDecimal("1.0")
b = a / 2.0 # => 0.5e0
...

Rational#coerce(other) -> Array (90643.0)

自身と other が同じクラスになるよう、自身か other を変換し [other, self] という 配列にして返します。

自身と other が同じクラスになるよう、自身か other を変換し [other, self] という
配列にして返します。

@param other 比較または変換するオブジェクト

//emlist[例][ruby]{
Rational(1).coerce(2) # => [(2/1), (1/1)]
Rational(1).coerce(2.2) # => [2.2, 1.0]
//}

Complex#coerce(other) -> [Complex, Complex] (82261.0)

other を Complex に変換して [変換後の other, self] の配列を返します。

other を Complex に変換して [変換後の other, self] の配列を返します。

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

//emlist[例][ruby]{
Complex(1).coerce(2) # => [(2+0i), (1+0i)]
//}

BigDecimal#eql?(other) -> bool (27622.0)

self が other と等しい場合に true を、そうでない場合に false を返します。

self が other と等しい場合に true を、そうでない場合に false を返します。

それぞれの値は BigDecimal#coerce で変換して比較される場合があります。

//emlist[][ruby]{
require 'bigdecimal'
BigDecimal('1.0') == 1.0 # => true
//}

BigDecimal#==(other) -> bool (18622.0)

self が other と等しい場合に true を、そうでない場合に false を返します。

self が other と等しい場合に true を、そうでない場合に false を返します。

それぞれの値は BigDecimal#coerce で変換して比較される場合があります。

//emlist[][ruby]{
require 'bigdecimal'
BigDecimal('1.0') == 1.0 # => true
//}

絞り込み条件を変える

BigDecimal#===(other) -> bool (18622.0)

self が other と等しい場合に true を、そうでない場合に false を返します。

self が other と等しい場合に true を、そうでない場合に false を返します。

それぞれの値は BigDecimal#coerce で変換して比較される場合があります。

//emlist[][ruby]{
require 'bigdecimal'
BigDecimal('1.0') == 1.0 # => true
//}