Re: printf and long double

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

 On 4/10/2010 3:03 ÎÎ, Bogdan Cristea wrote:
On Monday 04 October 2010 14:54:46 you wrote:
I wish I could get 24 decimal digits precision with the current long
double (80-bit). I can't get more than 15 digits even in a simple division.
I think that the extended-precision can't give more than 19 decimal
digits of precision (log(10,2^64)=19.2). The quadruple precision can
give at most 34 decimal digits (log(10,2^113)=34).

Please consider the example below:
long double a = 1.0L/7.0L;

Can't get more than 15 digits precision....-:(
Is this a compiler problem or libc's problem? In x86_64 machines the
long double values supposed to give at least 106-bit precision even when
implemented in software. Is gcc compliant with the quadruple notation?
Have you tried to specify manually the number of digits after the decimal
point ?

	long double a = 1.0L/7.0L;

On a 64 bits machine the output is:


Of course I did. But the result you get is the wrong one after the first 20 decimal point digits. The right result is given below with a high precision arithmetic library or with Mathematica or Matlab. And the three results are the same, but not the given one above which is the same for my machine.

To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at

[Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

Add to Google Powered by Linux