给定精度下的 gmp 浮点下限
我正在编写一个带有 GMP 及其任意精度浮点数的 C 库。我需要砍掉“小数字”,但我不知道如何确定什么是小数字。
假设我将 GMP 浮点 (mpf_t) 的精度设置为 n 位。那么在计算中什么才算小呢?
对于任何熟悉 GSL(GNU 科学库)的人来说,我需要相当于 GSL_DBL_EPSILON 的值,在我的 32 位计算机上,双精度值恰好是 2.2204460492503131e-16。
提前致谢,j。
I'm writing a C library with GMP and its arbitrary precision floats. I need to chop off "small numbers", but I don't know how to determine what is small.
Say I set the precision of GMP floats (mpf_t) to n bit. Then what is to be considered small in the calculation?
For any of you who might be familiar with GSL (GNU Scientific Library), I need the equivalent of their GSL_DBL_EPSILON, which for double, on my 32-bit computer, happpens to be 2.2204460492503131e-16.
Thanks in advance,j.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想我找到了神奇的数字:它是 2 ^{-(有效数字精度位)}
如这篇维基百科文章所详述。
I think I found the magical number: it is 2 ^{-(bits of significand precision)}
as detailed on this Wikipedia article.