0.1 = 0 ???
From: Paul Surgeon (surgptr_at_pop.co.za)
Date: 10/26/03
- Next message: Jumbo: "Re: [C]Understanding arrays/pointers"
- Previous message: Michael Strorm: "Re: Nasty code...but please critique it anyway :-)"
- Next in thread: Martijn Lievaart: "Re: 0.1 = 0 ???"
- Reply: Martijn Lievaart: "Re: 0.1 = 0 ???"
- Reply: osmium: "Re: 0.1 = 0 ???"
- Reply: Jumbo: "Re: 0.1 = 0 ???"
- Reply: mcheu: "Re: 0.1 = 0 ???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 26 Oct 2003 15:17:19 +0200
I cannot figure out how C++ works with data types/conversions.
I have tried two conditional statements :
if ((1 / 10) == 0)
cout << "Houston we have a problem\n";
double Data = (1 / 10);
if (Data == 0)
cout << "Houston we have a problem\n";
In both cases the conditional statement resolves as true!
How the *beep* can 0.1 be equal to 0?
What on earth am I doing wrong?
I have never seen this problem in my 4 years of Delphi coding.
What is C++ doing that is so different?
Thanks
Paul
- Next message: Jumbo: "Re: [C]Understanding arrays/pointers"
- Previous message: Michael Strorm: "Re: Nasty code...but please critique it anyway :-)"
- Next in thread: Martijn Lievaart: "Re: 0.1 = 0 ???"
- Reply: Martijn Lievaart: "Re: 0.1 = 0 ???"
- Reply: osmium: "Re: 0.1 = 0 ???"
- Reply: Jumbo: "Re: 0.1 = 0 ???"
- Reply: mcheu: "Re: 0.1 = 0 ???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|