るりまサーチ

最速Rubyリファレンスマニュアル検索!
37件ヒット [1-37件を表示] (0.023秒)
トップページ > クエリ:Float[x] > クエリ:*[x] > 種類:ライブラリ[x]

別のキーワード

  1. _builtin float
  2. float to_d
  3. json float
  4. float rationalize
  5. fiddle type_float

キーワード

検索結果

bigdecimal (85.0)

bigdecimal は浮動小数点数演算ライブラリです。 任意の精度で 10 進表現された浮動小数点数を扱えます。

...常) 数値に自動変換することはできません。
文字列を数値に自動変換したい場合は bigdecimal.c の
「/* #define ENABLE_NUMERIC_STRING */」のコメントを外してから、
再コンパイル、再インストールする必要があります。
文字列で数値...
...ん。
"10XX"なら 10、"XXXX"は 0 と扱われます。

//emlist[][ruby]{
require "bigdecimal"
require "bigdecimal/math"

a = BigMath.E(20)
c = a * "0.123456789123456789123456789" # 文字列を BigDecimal に変換してから計算
//}

無限大や非数を表す文字列として、
"Infin...
...きません。

//emlist[][ruby]{
require "bigdecimal"
require "bigdecimal/math"
a = BigMath.E(10)
p c = "0.123456789" * a # => "0.1234567890.123456789"
//}

これは、String#* の内部で、BigDecimal が暗黙的に Integer に変換された結果です。

===[a:internal_structure] 内部...

mathn (55.0)

Rational と Complex をよりシームレスに利用できるようにするライブラリです。数値ライブラリの挙動をグローバルに変更します。

...ください。

*
整数の除算が割り切れない場合、 Rational オブジェクトを返すようになります。
*
複素数や有理数の演算結果が実数や整数に収まる場合、 Float オブジェクトや Integer オブジェクトを返します。
*
Math モジュー...
...ルの数学関数の定義域と終域を、実数のみから複素数へと拡大します。

=== 利用局面

Integer や Float に比べ Rational は誤差無しで表現できる範囲が大きいため、
数値の演算において Rational をシームレスに利用したいことがあ...
...#=> 0
2 * Rational(1,2) #=> Rational(1,1)

require 'mathn'
1/2 #=> Rational(1,2)
2 * Rational(1,2) #=> 1

==== 実数と複素数の相互変換

同様にして Complex のインスタンスの虚部が 0 ならば、実部として含まれていた Rational, Float, また...

bigdecimal/util (53.0)

String、Integer、Float、Rational, NilClass オブジェクトを BigDecimal オブジェクトに変換する機能を提供します。

...String、Integer、Float、Rational オブジェクトを
BigDecimal オブジェクトに変換する機能を提供します。

*
String#to_d
*
Integer#to_d
*
Float#to_d
*
Rational#to_d


これらのメソッドを使うには 'bigdecimal/util' を require する必要があります。

...
...String、Integer、Float、Rational, NilClass オブジェクトを
BigDecimal オブジェクトに変換する機能を提供します。

*
String#to_d
*
Integer#to_d
*
Float#to_d
*
Rational#to_d
*
NilClass#to_d


これらのメソッドを使うには 'bigdecimal/util' を require する...

fiddle (43.0)

*.dllや*.soなど、ダイナミックリンクライブラリを扱うためのライブラリです。

...*.dllや*.soなど、ダイナミックリンクライブラリを扱うためのライブラリです。

dl と同等の機能を持ちますが、
dl は 2.0 以降deprecated となり、2.2.0 で削除されました。このライブラリ
を代わりに使います。

=== 使い方

通常...
...を定義します。

require "fiddle/import"
module M
extend Fiddle::Importer
dlload "libc.so.6","libm.so.6"
extern "int strlen(char*)"
end
# Note that we should not include the module M from some reason.

p M.strlen('abc') #=> 3

M.strlen を使用することで、ライ...
...以下のとおりです。

require 'fiddle/import'
module M
extend Fiddle::Importer
dlload "libc.so.6"
extern('int gettimeofday(void *, void *)')
Timeval = struct( ["long tv_sec",
"long tv_usec"])
end

timeval = M::Timeval.malloc
e = M.gettimeofday(timeval,...