MS C ++编译器出现错误的FP错误 [英] Bad FP error with MS C++ compiler

查看:61
本文介绍了MS C ++编译器出现错误的FP错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

// MS-Bug#999,995(剩下5个错误: - ):


const double d = DBL_MIN;


double v00 = 0.0;

bool f00 = v00 d;


double v01 = 0.1;

bool f01 = v01 d ;


为f00错误地给出''false'':-)

解决方案

" Adem24" < ad **** @ adem24.org.invalidwrote:


// MS-Bug#999,995(剩下5个错误:-):


const double d = DBL_MIN;


double v00 = 0.0;

bool f00 = v00 d;


double v01 = 0.1;

bool f01 = v01 d;


为f00错误地''false''。 .. :-)



错误在您的代码中。 DBL_MIN是一个最小的正值。


Alex


" Adem24"写道:


>

// MS-Bug#999,995(剩下5个错误:-):


const double d = DBL_MIN;


double v00 = 0.0;

bool f00 = v00 d;


double v01 = 0.1;

bool f01 = v01 d;


为f00错误地''false''... :-)



进一步的分析显示它与DBL_MIN没什么关系

但是值为ZERO!

即。 MS编译器在FP操作中不正确地处理值0.


在7月20日16:10,Adem24 < ade ... @ adem24.org.invalidwrote:


// MS-Bug *#999,995(剩下5个错误:-):



或Adem24 bug#3562?


>

* * * * const double d = DBL_MIN;



d大于0:或许它有助于阅读文档?


>

* * * * double v00 = 0.0;

* * * * bool * f00 = v00 d;


* * * * double v01 = 0.1;

* * * * bool * f01 = v01 d;


为f00错误地''false''... :-)



f00应该是真的。


/ Peter


// MS-Bug # 999,995 (5 left for 1 million bugs :-) :

const double d = DBL_MIN;

double v00 = 0.0;
bool f00 = v00 d;

double v01 = 0.1;
bool f01 = v01 d;

gives wrongly ''false'' for f00... :-)

解决方案

"Adem24" <ad****@adem24.org.invalidwrote:

// MS-Bug # 999,995 (5 left for 1 million bugs :-) :

const double d = DBL_MIN;

double v00 = 0.0;
bool f00 = v00 d;

double v01 = 0.1;
bool f01 = v01 d;

gives wrongly ''false'' for f00... :-)

The bug is in your code. DBL_MIN is a minimal positive value.

Alex


"Adem24" wrote:

>
// MS-Bug # 999,995 (5 left for 1 million bugs :-) :

const double d = DBL_MIN;

double v00 = 0.0;
bool f00 = v00 d;

double v01 = 0.1;
bool f01 = v01 d;

gives wrongly ''false'' for f00... :-)

Further analysis shows that it has nothing todo with the DBL_MIN
but the value ZERO !
Ie. the MS compiler treats the value 0 not correctly in FP ops.


On 20 Jul., 16:10, "Adem24" <ade...@adem24.org.invalidwrote:

// MS-Bug *# 999,995 (5 left for 1 million bugs :-) :

Or Adem24 bug# 3562?

>
* * * *const double d = DBL_MIN;

d is bigger than 0: perhaps it would help to read the documentation?

>
* * * *double v00 = 0.0;
* * * *bool * f00 = v00 d;

* * * *double v01 = 0.1;
* * * *bool * f01 = v01 d;

gives wrongly ''false'' for f00... :-)

f00 should be true.

/Peter


这篇关于MS C ++编译器出现错误的FP错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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