扩展精度浮点库 C/C++

2022-01-17 00:00:00 numeric floating-point numbers c c++

我正在寻找具有以下功能的扩展精度浮点库:

I am looking for an extended precision floating point library with the following features:

  • 固定数据类型大小(即扩展精度浮点数占用固定内存量)
  • 变量无需初始化
  • 指定尾数和指数的大小
  • C/C++ 接口
  • 支持非常大的浮点数 > 10^10000

我能找到的最接近的是 Ivano Primi 的 HPA 库.这个库的唯一问题是我无法扩展指数(它用 15 位固定).它允许我对尾数进行多种选择,但最大的可表示数字始终限于 10^4932.GMP 等其他库需要初始化,并且不允许固定大小的数据类型.关键是我不需要任意精度,而只是扩展.但我需要有非常大的指数.

The closest I could found is the HPA library by Ivano Primi. The only problem with this library is that I cannot extend the exponent (it is fixed with 15 bits). It allows me various choices for the mantissa, but the largest representable number is always limited to 10^4932. Other libraries like GMP require an initialization and do not allow for fixed size data types. The point is that I do not need arbitrary precision, but just extended. But I need to have very large exponents.

感谢您的帮助!

标记

推荐答案

看来ttmath很接近我在寻找什么.它允许使用指数和尾数值指定大浮点数,并且不需要初始化.

It seems that ttmath is very close to what I look for. It allows to specify big floats with exponent and mantissa value and it does not require initialization.

相关文章