Re: 0.1 = 0 ???

From: Anand Hariharan (desh_bakth_at_yahoo.com)
Date: 10/29/03


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



Relevant Pages

  • Re: If someone just took a minute to listen to me
    ... Sure, any time you need a snip let me know, I'll be glad to do it for you. ... Yes the point is Einstein knew no science or mathematics. ... "Orr was crazy and could be grounded. ... "Orr would be crazy to fly more missions and sane if he didn't, ...
    (sci.physics)
  • Re: London/Aitch
    ... > Feels like the world is going crazy. ... Look at Egypt. ... Poor sods. ...
    (rec.motorcycles.harley)
  • Re: The Prog Emperor Has No Clothes
    ... Ron Moses wrote: ... Am I crazy, or does anyone else experience Porcupine Tree in this way? ...
    (rec.music.progressive)
  • Re: A Question
    ... Rachealli wrote: ... things are a little less crazy. ... <insert standard chat to quack caveat, not that you've got any choice ...
    (uk.people.support.depression)
  • Re: 2nd Chez Watt - Astronomers: Dark galaxy discovered
    ... shane enriched us with: ... just not generally by it 'appearing' which in normal usage is ... Your theory is crazy, but it's not crazy enough to be true. ...
    (sci.astro)