Bad FP error with MS C++ compiler

A

Adem24

// 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... :)
 
A

Alex Blekhman

Adem24 said:
// 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
 
A

Adem24

Adem24 said:
// 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.
 
P

peter koch

// 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
 
J

Juha Nieminen

Adem24 said:
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.

Given that DBL_MIN is a positive value (larger than 0), exactly how is
this a bug?
 
E

Erik Wikström

// 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... :)

Did you submit this "bug" to the gcc-team also, because I get the same
effect using gcc as with MSVC.
 
G

Gennaro Prota

Erik said:
Did you submit this "bug" to the gcc-team also, because I get the same
effect using gcc as with MSVC.

:) Out of curiosity, is there really a bug count for VC++, somewhere?
 
T

Tim Roberts

Adem24 said:
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.

I can't tell from this whether you are admitting that you are wrong, or are
moving off into other foolishness. "f00" SHOULD be false. Do you now
agree with that?
 
J

joseph cook

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.

Woah! Slow down. Millions (Billions? Trillions?) of lines of code
have been written using Microsoft compilers. Think about the
likelyhood that you are the first person to have tried using "0" in a
FP operation, and then consider the possibility that the problems lies
on your end, not the compilers.

--JC
 
J

James Kanze

Gennaro said:
[..]
:) Out of curiosity, is there really a bug count for VC++, somewhere?
There must be. Since you can add to the collection (and check
if your addition is in the collection), there must be a way to
obtain the size of the collection, right?

But what does it mean? Anyone who's worked in support at one
time or another knows that 90% of the complaints are user error
(like the one that started this thread). The fact that VC++ is
the most widely used compiler by beginners probably means that
it will get the most "bug reports": for some beginners (often
the most stupid), the problem is always the compiler, and not
their stupidity.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,173
Messages
2,570,938
Members
47,475
Latest member
NovellaSce

Latest Threads

Top