C/C++の宿題片付けます 162代目
■ このスレッドは過去ログ倉庫に格納されています
0820デフォルトの名無しさん
2013/02/11(月) 17:31:32.60ソースコードと解説。
MPIR Multiple Precision Integers and Rationals
http://www.mpir.org/
MPIR (mathematics software) - Wikipedia
MPIR is an open-source software multiprecision integer library forked from the GMP project.
It consists of much code from past GMP releases, and much newer original contributed code.
MPIR is optimised for many processors (CPUs). Assembly language code exists for these as of 2012[update]:
ARM, DEC Alpha 21064, 21164, and 21264, AMD K6, K6-2, Athlon, K8 and K10,
Intel Pentium, Pentium Pro-II-III, Pentium 4, generic x86, Intel IA-64, Core 2, i7,
Atom, Motorola-IBM PowerPC 32 and 64, MIPS R3000, R4000, SPARCv7, SuperSPARC, generic SPARCv8, UltraSPARC.
任意精度の演算ができるライブラリと言えばGMPだが、Windows環境では使いにくいのが欠点。
そしたら、GMPからフォークしたMPIRというライブラリがあった。
計算速度は、アセンブラ版が速い。そうでないものの5倍くらいの速さだった。64bitのアセンブラなら、更に倍くらい速いらしい。
最初、GMPのC言語版をビルドして使ったら、スーパーπの倍以上遅かったが、MPIRを使うとあっさり追い抜くことができた。
ドキュメント類は、MPIRのページにもあるし、GMPのものでもいい。GMPで書いたコードは、たぶんそのまま動く。
http://d.hatena.ne.jp/merom686/20111107/1320674119
■ このスレッドは過去ログ倉庫に格納されています