2件ヒット
[1-2件を表示]
(0.069秒)
ライブラリ
- bigdecimal (1)
-
json
/ add / bigdecimal (1)
検索結果
-
BigDecimal
# to _ json(*args) -> String (607.0) -
自身を JSON 形式の文字列に変換して返します。
..._json を呼び出しています。
@param args 使用しません。
//emlist[例][ruby]{
require 'json/add/bigdecimal'
BigDecimal('0.123456789123456789').to_json # => "{\"json_class\":\"BigDecimal\",\"b\":\"36:0.123456789123456789e0\"}"
//}
@see JSON::Generator::GeneratorMethods::Hash#to_json... -
BigDecimal
# split -> [Integer , String , Integer , Integer] (355.0) -
BigDecimal 値を 0.xxxxxxx*10**n と表現したときに、 符号 (NaNのときは 0、それ以外は+1か-1になります)、 仮数部分の文字列("xxxxxxx")と、基数(10)、更に指数 n を配列で返します。
...
BigDecimal 値を 0.xxxxxxx*10**n と表現したときに、
符号 (NaNのときは 0、それ以外は+1か-1になります)、
仮数部分の文字列("xxxxxxx")と、基数(10)、更に指数 n を配列で返します。
//emlist[][ruby]{
require "bigdecimal"
a = BigDecimal("3.14159265")
f......, x, y, z = a.split
//}
とすると、f = 1、x = "314159265"、y = 10、z = 1 になります。
従って、以下のようにする事で Float に変換することができます。
//emlist[][ruby]{
s = "0."+x
b = f*(s.to_f)*(y**z)
//}
@see BigDecimal#to_f...