Re: 0.1 = 0 ???
From: Anand Hariharan (desh_bakth_at_yahoo.com)
Date: 10/29/03
- Next message: Gene Wirchenko: "Re: integer to characters"
- Previous message: Alex Vinokur: "Re: CPU time versus wall clock time"
- In reply to: Jumbo: "Re: 0.1 = 0 ???"
- Next in thread: Jumbo: "Re: 0.1 = 0 ???"
- Reply: Jumbo: "Re: 0.1 = 0 ???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Oct 2003 08:36:08 -0800
"Jumbo" <(nospam)@12freeukisp.co.uk> wrote in message news:<1067177551.619919@news.minx.net.uk>...
> "Paul Surgeon" <surgptr@pop.co.za> wrote in message
> news:bnghgu$3gt$1@ctb-nnrp2.saix.net...
> > 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";
> >
[snip]
> I think it's because its getting rounded down,
> I know it's drives you crazy and it has driven me crazy on numerous
> occassions too .- LOL
>
It is NOT getting rounded down! It is performing integer arithmetic.
The number of 10s in a 1 IS zero.
HTH,
- Anand
- Next message: Gene Wirchenko: "Re: integer to characters"
- Previous message: Alex Vinokur: "Re: CPU time versus wall clock time"
- In reply to: Jumbo: "Re: 0.1 = 0 ???"
- Next in thread: Jumbo: "Re: 0.1 = 0 ???"
- Reply: Jumbo: "Re: 0.1 = 0 ???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|