This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc compilation on amd opteron and precision


Muge Unel wrote:

p= (long double) 1.0 / (long double) 3.0;
q = (long double) p *  (long double) 3.0 -  (long double) 1.0;
printf ("1 /3 is:              %.30e\n", p);
printf ("(1 / 3) x 3 - 1 is:   %.30e\n", q);

you probably want %.30Le format if p and q are indeed long doubles, as man -S3 printf tells you.

nathan


-- Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]