bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "seq .1 .1" would mistakenly generate no output on FreeBSD 6.1


From: Jim Meyering
Subject: Re: "seq .1 .1" would mistakenly generate no output on FreeBSD 6.1
Date: Wed, 21 Nov 2007 13:40:18 +0100

Bruno Haible <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]