delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/12/13/10:00:22

From: "Edd Dawson" <hotcakes AT planetquake DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <c5aK9.1738$2E DOT 528 AT news-binary DOT blueyonder DOT co DOT uk> <3DF984EB DOT 8010102 AT earthlink DOT net>
Subject: re: (solved)
Lines: 61
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <IvmK9.14146$2E.4270@news-binary.blueyonder.co.uk>
Date: Fri, 13 Dec 2002 14:57:31 -0000
NNTP-Posting-Host: 80.192.26.95
X-Complaints-To: abuse AT blueyonder DOT co DOT uk
X-Trace: news-binary.blueyonder.co.uk 1039791208 80.192.26.95 (Fri, 13 Dec 2002 14:53:28 GMT)
NNTP-Posting-Date: Fri, 13 Dec 2002 14:53:28 GMT
Organization: blueyonder (post doesn't reflect views of blueyonder)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Please read my previous reply.
Problem is solved. Simple slip up on my part.

Edd

"Martin Ambuhl" <mambuhl AT earthlink DOT net> wrote in message
news:3DF984EB DOT 8010102 AT earthlink DOT net...
> Edd Dawson wrote:
> > Hi,
> >
> > I came across an unexpected result when executing a program I'm writing.
> > After tracking it down in the source, I wrote a few lines of test code
and
> > found that a simple evaluation of an inequality was failing.
> > Here is the small chunk of test code from the program I am writing:
> >
> > //test code starts here
> >
> > printf("\nRPP = %d\n", raysperpixel);
> > if(raysperpixel < 1)
> >      printf("%d is less than 1\n", raysperpixel);
> > else
> >      printf("%d is greater than or equal to 1\n", raysperpixel);
> >
> > //test code ends here
> >
> > raysperpixel is an int (i.e its defined properly).
> > Here is the corresponding output:
> >
> > RPP = -35
> > -35 is greater than or equal to 1
>
> I don't believe you.  Here is a compilable version of your code, together
> with the output:
>
> #include <stdio.h>
>
> int main(void)
> {
>      int raysperpixel = -35;
>      printf("\nRPP = %d\n", raysperpixel);
>      if (raysperpixel < 1)
>          printf("%d is less than 1\n", raysperpixel);
>      else
>          printf("%d is greater than or equal to 1\n", raysperpixel);
>      return 0;
> }
>
>
> RPP = -35
> -35 is less than 1
>
> >
> > This makes about as much sense as the program's output! Can anyone help
me
> > out? I'm pretty sure it's a bug,
>
> I'm pretty sure you've got some error in your code.
>


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019