デフォルト浮動小数点数の精度を別のものに変更するにはどうすればよいですか?私は計算が必要なので、これが必要です。浮動小数点のデフォルト精度を上げる必要があります。浮動小数点数の精度を高める
答えて
私は最近この問題に対処しなければならず、mpmathは完璧でした。これはBSDライセンスのもとでは純粋なPythonです。
Mpmath is a pure-Python library for multiprecision floating-point arithmetic. It provides an extensive set of transcendental functions, unlimited exponent sizes, complex numbers, interval arithmetic, numerical integration and differentiation, root-finding, linear algebra, and much more. Almost any calculation can be performed just as well at 10-digit or 1000-digit precision, and in many cases mpmath implements asymptotically fast algorithms that scale well for extremely high precision work
それはあまりにも遅くはない、とインストールされている場合、それは(C-coded Python extension modules that support fast multiple-precision arithmetic
を)gmpyライブラリを活用することができます。
scipy.integrate.odeintを使用する「TypeError:配列を必要な型に安全にキャストできません」=(scipy.integrate.odeintがすべてを浮動小数点に変換するようです。 – user983302
しかし、それは独自のodeソルバーです - [odefun](http ://mpmath.googlecode.com/svn/trunk/doc/build/calculus/odes.html)OK、これを解決策にしましょう。 – user983302
[unlimitedness]に関するテキストを更新しました。(http://mpmath.org/doc/ current/technical.html#representation-of-numbers): "Mpmathは仮数と指数の両方に任意の精度の整数を使用するため、数値はコンピュータのメモリで許容される大きさになる可能性があります。非常に大きな数字。 –
scipy.integrateとbigfloatをお互いに扱うことはできますか?現在、私は "TypeError:配列は安全に必要な型にキャストすることはできません" scipy.integrate.odeintにBigFloat引数を渡すとき – user983302
@ user983302多分[this](http://stackoverflow.com/questions/7770870/numpy-array-with -dtype-decimal)が役に立ちます。 – arshajii
- 1. 浮動小数点精度
- 2. 浮動小数点数の精度
- 3. Haskellの高精度浮動小数点数は?
- 4. 倍精度浮動小数点数の浮動小数点コードを読む
- 5. 浮動小数点型の精度printf
- 6. MongoDB浮動小数点値の精度?
- 7. 浮動小数点精度形式
- 8. 倍精度浮動小数点型+ Eigen
- 9. 単精度浮動小数点表現から半精度浮動小数点数への変換
- 10. 浮動小数点数の精度を設定する
- 11. 異なるシステムでの浮動小数点数の精度
- 12. javascript浮動小数点数の精度浮動小数点数が6桁を超えて
- 13. 範囲の縮小単精度浮動小数点の精度が悪い
- 14. 精度解析の浮動小数点数の損失
- 15. AndroidでGroovyで倍精度浮動小数点数を浮動小数点にすると
- 16. 十進数から半精度の浮動小数点
- 17. Powershell - IEEE754単精度浮動小数点の16進数
- 18. hdf5データセットの浮動小数点精度を設定する
- 19. インテルAVX:倍精度浮動小数点変数
- 20. oracleを読んだあとjythonの浮動小数点精度
- 21. パンダのデータフレームの比較と浮動小数点の精度
- 22. Swift 3で浮動小数点精度が失われる
- 23. C#DateTime:倍精度浮動小数点型時間の倍精度化
- 24. 浮動小数点配列を倍精度浮動小数点配列に変換してすぐに戻す
- 25. ElasticSearchファセットの用語クエリの浮動小数点精度
- 26. MVC3エディターの倍精度浮動小数点型の表記
- 27. SQLの浮動小数点精度の設定
- 28. 倍精度浮動小数点数型(Double#)の倍精度浮動小数点型をscalaで比較すると保存されますか?
- 29. 単精度浮動小数点の使用
- 30. python Qt浮動小数点精度のboost-pythonサブモジュール
Pythonとnumpyはデフォルトで倍精度浮動小数点を使用します。不十分な「正確さ」を持っていると思わせる原因は何ですか? – talonmies
あなたはhttp://docs.python.org/2/library/decimal.htmlを見ましたか? –
あなたの計算に 'decimal'を使うことができますが、' numpy'のパフォーマンス上の利点を失います。私の知る限りでは、このトレードオフから抜け出せません。プロセッサがネイティブで動作できる最も正確なデータ型は、numpyが使用するものです。 – millimoose