Sender: tim AT riker DOT skynet DOT be Message-ID: <3B00DC4E.D5551973@falconsoft.be> Date: Tue, 15 May 2001 09:35:42 +0200 From: Tim Van Holder Organization: Falcon Software NV X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.16-3 i686) X-Accept-Language: en, nl-BE, nl MIME-Version: 1.0 To: Dennis Yelle CC: djgpp AT delorie DOT com Subject: Re: cout ignores the last 11 bits of long double References: <3AFC71C1 DOT D3CDF864 AT jps DOT net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Dennis Yelle wrote: > > Here is the program: > > #include > #include > #include > > long double f( long double x) > { > return pow( double(x), double( x*x*x)); > } > > [big snip] > > It looks like cout operator<< ignores the last 11 bits of a > long double. > I'm thinking f() is the actual culprit. For gcc 2.95.2, cmath simply includes math.h (though it has other declarations, they are #if'ed out). math.h's pow() returns a double, not a long double. For gcc3, pow() is declared in cmath in many versions, including one that returns a long double. However, unless the system library has powl() (and DJGPP doesn't seem to have it, according to math.h), it merely returns the result of a regular pow() call, whis is defined as returning a double. No amount of upcasting can magically make higher precision appear. -- Tim Van Holder - Falcon Software N.V. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= This message was posted using plain text. I do not endorse any products or services that may be hyperlinked to this message.