Mail Archives: djgpp/2002/12/13/10:00:22
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 -