[Top][All Lists]

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

Re: Bug in strtold()

From: Petter Reinholdtsen
Subject: Re: Bug in strtold()
Date: Thu, 14 Oct 2004 23:02:19 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (usg-unix-v)

[Adrian S. W. TAM]
> Is that a bug?n

Looks strange to me.  With your program, I get this output:

  0.123456789 becomes 0.12345678899999999734
  0.123456789 becomes -0.00000000000000000000

But I suspect the problem here is the lack of a proper prototype for
strtold().  When I compile your program with -Wall -W, I get this

  x.c: In function `main':
  x.c:7: warning: implicit declaration of function `strtold'
  x.c:7: warning: long double format, different type arg (arg 3)

So the long double return type isn't handled correctly.  You will have
to look in <stdlib.h> to find out what to define to get the strtold()
prototype enabled.

(Always enable lots of compile warnings when compiling the source. :)

reply via email to

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