c++ - Bug? Comparison of doubles involving long double
- robertschlicht yahoo.com Dec 03 2003
- "Walter" <walter digitalmars.com> Dec 05 2003
I am using DMC version 8.38 on Win32. The
result of comparing two doubles seems to
get wrong sometimes when a long double and
the ?: operator are involved. Maybe I am
wrong, but I think the following code
should return 0, not 1.
Thanks in advance for any suggestions.
Robert
#include <stdio.h>
#include <math.h>
int main(void)
{
double x, y;
long double z;
x = sqrt(1);
y = sqrt(2);
z = 0;
printf("y > x, so the return value should be zero (false). It isn't.");
return y < (1? x : z);
}
Dec 03 2003
Looks like a bug. I'll take it from here. Thanks, -Walter
Dec 05 2003








"Walter" <walter digitalmars.com>