为什么在GCC中-fidiprocal-math不安全? [英] Why is -freciprocal-math unsafe in GCC?

查看:194
本文介绍了为什么在GCC中-fidiprocal-math不安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  -freciprocal-math 在GCC中改变了以下代码:双a = b / c; 

  double tmp = 1 / c; 
double a = b * tmp;

在GCC手册中,据说这样的优化是不安全的,不符合IEEE标准。但我想不出一个例子。你能举个例子吗?

解决方案

除以10并乘以0.1000000000000000055511151231257827021181583404541015625不一样。


-freciprocal-math in GCC changes the following code

double a = b / c;

to

 double tmp = 1/c;
 double a = b * tmp;

In GCC manual, it's said that such an optimization is unsafe and is not sticked to IEEE standards. But I cannot think of an example. Could you give an example about this?

解决方案

Dividing by 10 and multiplying by 0.1000000000000000055511151231257827021181583404541015625 are not the same thing.

这篇关于为什么在GCC中-fidiprocal-math不安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆