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: Bruno Haible
Subject: Re: "seq .1 .1" would mistakenly generate no output on FreeBSD 6.1
Date: Wed, 21 Nov 2007 12:49:44 +0100
User-agent: KMail/1.5.4

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;
}





reply via email to

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