473,779 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bad FP error with MS C++ compiler

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

Jul 20 '08 #1
12 1299
"Adem24" <ad****@adem24. org.invalidwrot e:
// 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
Jul 20 '08 #2
"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.

Jul 20 '08 #3
On 20 Jul., 16:10, "Adem24" <ade...@adem24. org.invalidwrot e:
// 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
Jul 20 '08 #4
peter koch wrote:
On 20 Jul., 16:10, "Adem24" <ade...@adem24. org.invalidwrot e:
>// 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.
REALLY? Should it? What's DBL_MIN, by definition? Hint: it's
defined on the 5.2.4.2.2 of the C standard.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 20 '08 #5
Adem24 wrote:
"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.
Given that DBL_MIN is a positive value (larger than 0), exactly how is
this a bug?
Jul 20 '08 #6
On 2008-07-20 16:10, 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... :-)
Did you submit this "bug" to the gcc-team also, because I get the same
effect using gcc as with MSVC.

--
Erik Wikström
Jul 20 '08 #7
Erik Wikström wrote:
On 2008-07-20 16:10, 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... :-)

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?

--
Gennaro Prota | <https://sourceforge.net/projects/breeze/>
Do you need expertise in C++? I'm available.
Jul 20 '08 #8
"Adem24" <ad****@adem24. org.invalidwrot e:
>"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.
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?
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 21 '08 #9
Gennaro Prota wrote:
[..]
:-) 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? Now, I am not sure there is a publicly
available bug count. See https://connect.microsoft.com/VisualStudio/

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 21 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3686
by: Jagdeesh | last post by:
Hai Colleagues, I am using Tomcat 4.1.24 and JDK 1.4.0_03 in my winXP machine. I've transferred a set of folders(containing jsp files) into tomcat's webapps directory(to /webapps/bob , /webapps/sue) and i have added the folders bob, sue in my server.xml(in the context path). When i am trying to run jsp files from my browser, it works fine. But, the following jsp files reports some exceptions which is quite hard to understand. Here is...
6
8626
by: paul calvert | last post by:
I hope somewhere here has encountered and solved a similar problem in the past. 1) on a new Win2000 PC: installed Visual C++ 6.0 download & install single file Service Pack 5.0 2) try to build my gui and dll projects, whose project, workspace, source files all resided on network drive mapped to H. The H mapping,
2
17572
by: Mike Fisher | last post by:
I'm seeing an error when I try to run/debug a web service. Although it doesn't happen every time, it does occur more than half of the times I hit F5. It appears to be returned by the the JIT compiler as the page is requested by the browser. The result is that the "compiler failed with error code 2000". I have tested the same code on another workstation with VS.NET and it works fine EVERY time. I'm convinced it's not the code and I...
30
2961
by: Neil Zanella | last post by:
Hello, Allow me to share my frustrations with GNU g++. This is the second time something similar happens to me: I can't find anything wrong with my C++ program and yet I get segfaults, and eventually, here is what happens. Anyone ever experience anything similar. This or similar untrackable problems happen to me whenever I write a large class... anyone have had similar experiences??? make
2
5840
by: Mary | last post by:
Hello, I am having a problem with the cl compiler. I have written a C class (RegConnect.c) which uses Win32 API functions such as RegOpenKey, RegCloseKey etc. Initially when I was trying to create a dll, using the cl compiler I was getting many unresolved external errors, Example 1 below (8 in total, 7 to do with the registry function calls and 1 from wsprintfA call) as I hadn't included the AdvAPI32.lib file. So I created a LINK...
0
2401
by: rollasoc | last post by:
Hi, I seem to be getting a compiler error Internal Compiler Error (0xc0000005 at address 535DB439): likely culprit is 'BIND'. An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the
1
13253
by: Ayende Rahien | last post by:
reparing resources... Updating references... Performing main compilation... error CS0583: Internal Compiler Error (0xc0000005 at address 53168B12): likely culprit is 'BIND'. An internal error has occurred in the compiler. To work around this problem,
6
2730
by: David Lack | last post by:
Hi, I recently installed a 60-day trial of .NET 2003 on my development system. I made tests with previous personal projects (which compiled ok with VC6) and some open source files, and keep facing the same problem with many of them: I keep getting errors such as: ....\WinUser.h(8028): fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2701)
1
3776
by: kvarada | last post by:
Hello Experts, I am building my application on WinNT.4.0_i386_MSVC.7.1 platform. When I build the application on a stand alone machine, it builds fine. But when I build the same application from a linux box using rsh it gives me the errors below Microsoft (R) Development Environment Version 7.10.3077. Copyright (C) Microsoft Corp 1984-2001. All rights reserved. ------ Build started: Project: SigComp, Configuration: Release Win32 ------...
0
2067
by: silviu | last post by:
Hello I'm trying to install Microsoft SQL 2005 Server Express Edition but I'm getting the following error: SQL Server Setup unexpectedly failed... Then it says something about a log file. Here's the contents of that log: Microsoft SQL Server 2005 Setup beginning at Thu Nov 22 22:30:08 2007 Process ID : 3856 e:\6f695192a2be55cedd30e3868397bfd2\setup.exe Version: 2005.90.1399.0 Running: LoadResourcesAction at: 2007/10/22 22:30:8...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10305
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10137
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9928
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7483
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.