7件ヒット
[1-7件を表示]
(0.146秒)
ライブラリ
- ビルトイン (2)
- bigdecimal (4)
- openssl (1)
クラス
- BigDecimal (4)
- Complex (1)
-
OpenSSL
:: BN (1) - Rational (1)
検索結果
先頭5件
-
Complex
# coerce(other) -> [Complex , Complex] (63925.0) -
other を Complex に変換して [変換後の other, self] の配列を返します。
other を Complex に変換して [変換後の other, self] の配列を返します。
@raise TypeError 変換できないオブジェクトを指定した場合に発生します。
//emlist[例][ruby]{
Complex(1).coerce(2) # => [(2+0i), (1+0i)]
//} -
OpenSSL
:: BN # coerce(other) -> Array (63379.0) -
自身と other が同じクラスになるよう、自身か other を変換し [other, self] という配列にして返します。
自身と other が同じクラスになるよう、自身か other を変換し
[other, self] という配列にして返します。
基本的に other が整数のときに、自身を Integer のオブジェクトに
変換して [other, 変換後オブジェクト] にして返します。
それ以外の場合は例外 TypeError を発生させます。
//emlist[][ruby]{
require 'openssl'
p 1.to_bn.coerce(2) # => [2, 1]
//}
@param other 変換の基準となるオブジェクト
@raise TypeError 変換に失敗した場合に発... -
BigDecimal
# coerce(other) -> Array (63343.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 (63343.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]
//} -
BigDecimal
# eql?(other) -> bool (18322.0) -
self が other と等しい場合に true を、そうでない場合に false を返します。
self が other と等しい場合に true を、そうでない場合に false を返します。
それぞれの値は BigDecimal#coerce で変換して比較される場合があります。
//emlist[][ruby]{
require 'bigdecimal'
BigDecimal('1.0') == 1.0 # => true
//} -
BigDecimal
# ==(other) -> bool (9322.0) -
self が other と等しい場合に true を、そうでない場合に false を返します。
self が other と等しい場合に true を、そうでない場合に false を返します。
それぞれの値は BigDecimal#coerce で変換して比較される場合があります。
//emlist[][ruby]{
require 'bigdecimal'
BigDecimal('1.0') == 1.0 # => true
//} -
BigDecimal
# ===(other) -> bool (9322.0) -
self が other と等しい場合に true を、そうでない場合に false を返します。
self が other と等しい場合に true を、そうでない場合に false を返します。
それぞれの値は BigDecimal#coerce で変換して比較される場合があります。
//emlist[][ruby]{
require 'bigdecimal'
BigDecimal('1.0') == 1.0 # => true
//}