Visual C++中的浮点精度

8 c++ math floating-point floating-accuracy visual-c++

HI,

我试图使用Jonathan Richard Shewchuk的计算几何的 强大谓词.

我不是程序员,所以我甚至不确定我在说什么,我可能会做一些基本的错误.

关键是谓词应该允许具有自适应浮点精度的精确算法.在我的电脑上:华硕pro31/S(Core Due Centrino处理器)它们无法正常工作.问题可能在于我的计算机可能会使用与Shewchuk使用的浮点精度冲突的一些改进.作者说:

/* On some machines, the exact arithmetic routines might be defeated by the  */
/*   use of internal extended precision floating-point registers.  Sometimes */
/*   this problem can be fixed by defining certain values to be volatile,    */
/*   thus forcing them to be stored to memory and rounded off.  This isn't   */
/*   a great solution, though, as it slows the arithmetic down.              */
Run Code Online (Sandbox Code Playgroud)

现在我想知道的是,有一种方法,可能是一些编译器选项,来关闭内部扩展精度浮点寄存器.

我非常感谢你的帮助

Mic*_*urr 0

如果您使用的是 GCC,那么这里的答案可能会有所帮助:

如果您使用其他编译器,您可能能够在该示例中找到一些线索(或者可能对该答案发表评论以查看 Mike Dinsdale 是否知道。