Bruno Haible <[EMAIL PROTECTED]> wrote:

> Jim Meyering wrote:
>> 0.1L == (long double) 0.1
>> evaluates to true.
>
> OK, so let's try a runtime test instead of a compile-time test.
>
> What does this program give?
>
> #include <stdio.h>
> #include <stdlib.h>
> long double a = 4.0L;
> long double b = 5.0L;
> int main()
> {
>   long double x = a / b;
>   long double y = strtold ("0.8", NULL);
>   printf ("%d\n", x == y);
>   printf ("x = %04X%04X%04X\n", ((unsigned int *) &x)[2],
>           ((unsigned int *) &x)[1], ((unsigned int *) &x)[0]);
>   printf ("y = %04X%04X%04X\n", ((unsigned int *) &y)[2],
>           ((unsigned int *) &y)[1], ((unsigned int *) &y)[0]);
>   return 0;
> }

Yep.  That ought to do it:

  freebsd6$ ./a.out
  0
  x = BFBF3FFECCCCCCCCCCCCD000
  y = BFBF3FFECCCCCCCCCCCCCCCD


Reply via email to