るりまサーチ

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

別のキーワード

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

キーワード

検索結果

bigdecimal (6049.0)

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

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

//emlist[][ruby]{
require 'bigdecimal'
a = BigDecimal("0.123456789123456789")
b = BigDecimal("123456.78912345678", 40)
print a + b # => 0.123456912580245903456789e...
...BigDecimal では正確な値を得る事ができます。

//emlist[例1: 0.0001 を 10000 回足す場合。][ruby]{
sum = 0
for i in (1..10000)
sum = sum + 0.0001
e
nd
print sum # => 0.9999999999999062
//}

//emlist[例2: 0.0001 を 10000 回足す場合。(BigDecimal)][ruby]{
require 'bigdecim...
...'

sum = BigDecimal("0")
for i in (1..10000)
sum = sum + BigDecimal("0.0001")
e
nd
print sum # => 0.1e1
//}

//emlist[例3: 1.2 - 1.0 と 0.2 との比較][ruby]{
require "bigdecimal"

(BigDecimal("1.2") - BigDecimal("1.0")) == BigDecimal("0.2") # => true

(1.2 - 1.0) == 0.2 # => false
//}

=== 特...

bigdecimal/util (6023.0)

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

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

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


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

...
...お、Ruby 2.6.0 以降では、'bigdecimal/util' を require すると、
'bigdecimal' 本体も require されます。...
...tring、Integer、Float、Rational, NilClass オブジェクトを
BigDecimal オブジェクトに変換する機能を提供します。

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


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

なお、Ruby 2.6.0 以降では、'bigdecimal/util' を require すると、
'bigdecimal' 本体も require されます。...

fiddle (6019.0)

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

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

=== 使い方

通常は fiddle/import ライブラリを require して
Fiddle::Importer モジュールを使用します。
dl と基本...
...Fiddle モジュール自体はプリミティブな機能しか提供していません。
Fiddle::Importer モジュールは以下のようにユーザが定義した
モジュールを拡張する形で使います。

require "fiddle/import"
module M
e
xtend Fiddle::Importer
e
nd

...
...ad や extern などのメソッドが使用できるようになります。
以下のように dlload を使ってライブラリをロードし、
使用したいライブラリ関数に対して extern メソッドを呼んで
ラッパーメソッドを定義します。

require "fiddle/impo...
...すが、
dl は 2.0 以降deprecated となり、2.2.0 で削除されました。このライブラリ
を代わりに使います。

=== 使い方

通常は fiddle/import ライブラリを require して
Fiddle::Importer モジュールを使用します。
Fiddle モジュール自体はプ...
...していません。
Fiddle::Importer モジュールは以下のようにユーザが定義した
モジュールを拡張する形で使います。

require "fiddle/import"
module M
e
xtend Fiddle::Importer
e
nd

以後、このモジュールで dlload や extern などのメソッド...
... extern メソッドを呼んで
ラッパーメソッドを定義します。

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

p M.strlen(...