るりまサーチ

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

別のキーワード

  1. _builtin rational
  2. rational **
  3. json/add/rational to_json
  4. json/add/rational json_create
  5. rational /

ライブラリ

キーワード

検索結果

<< < ... 2 3 4 >>

Rational#to_json(*args) -> String (21020.0)

自身を JSON 形式の文字列に変換して返します。

...JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 使用しません。

//emlist[例][ruby]{
require 'json/add/rational'
Rational
(1, 3).to_json # => "{\"json_class\":\"Rational\",\"n\":1,\"d\":3}"
//}

@see JSON::Generator::GeneratorMethods::Hash#to_json...
...@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json
に渡されます。

//emlist[例][ruby]{
require 'json/add/rational'
Rational
(1, 3).to_json # => "{\"json_class\":\"Rational\",\"n\":1,\"d\":3}"
//}

@see JSON::Generator::GeneratorMethods::Hash#to_json...

Rational#**(rhs) -> Numeric (21014.0)

@todo

...@todo

self のべき乗を返します。 Rational になるようであれば Rational で返します。...

Rational#coerce(other) -> Array (21014.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]
//}...

Rational#to_d(nFig) -> BigDecimal (21014.0)

自身を BigDecimal に変換します。

...桁数

@return BigDecimal に変換したオブジェクト

@raise ArgumentError nFig に 0 以下を指定した場合に発生します。

//emlist[][ruby]{
require "bigdecimal"
require "bigdecimal/util"
p Rational(1, 3).to_d(3) # => 0.333e0
p Rational(1, 3).to_d(10) # => 0.3333333333e0
//}...

Rational#hash -> Integer (21002.0)

自身のハッシュ値を返します。

自身のハッシュ値を返します。

@return ハッシュ値を返します。


@see Object#hash

絞り込み条件を変える

<< < ... 2 3 4 >>