Click to See Complete Forum and Search --> : long double pow(long double, long double)


idwilson
July 22nd, 2004, 12:31 PM
Hi,

I'm sorry if this is a silly question but the pow function is confusing the **** out of me.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_pow.asp

The above link appears to indicate that there is a long double version of the pow function, which I have tried to use only to find that my variables only reach double precision - and the pow function then uses the double pow (double, double) version.

I've looked at the project settings and nothing obvious hits me. :(

Checking the data type ranges long double would be perfect for my purposes, but running in debug seems to indicate that long double variables are being treated as doubles?

Can someone please shed some light on this?

What am I doing wrong? :confused:

Thanks for reading this.

Ian

MrViggy
July 22nd, 2004, 12:48 PM
A quick search of the MSDN shows:

Previous 16-bit versions of Microsoft C/C++ and Microsoft Visual C++ supported the long double, 80-bit precision data type. In Win32 programming, however, the long double data type maps to the double, 64-bit precision data type. The Microsoft run-time library provides long double versions of the math functions only for backward compatibility.

So, long double is the same as double. I guess they figured that you don't need 80 bits of precision anymore.

Viggy

idwilson
July 22nd, 2004, 02:27 PM
Ah,

I read that but I thought I had misunderstood it given the follow taken from MSDN:

double 8 none 1.7E +/- 308 (15 digits)
long double 10 none 1.2E +/- 4932 (19 digits)

The long double data type (80-bit, 10-byte precision) is mapped directly to double (64-bit, 8- byte precision) in Windows NT, Windows 98, and Windows 95.

I had hoped that this didn't apply to their later Operating Systems.

Especially so given their Visual C++ Run-Time Library reference:

long double pow(
long double x,
long double y
); // C++ only

So, MS do not have a 1.2E +/- 4932 data type?

Ian

P.S. Apparently h e l l gets turned into ****. :eek: Oh, and I spent eight hours trying to find something that was clear and concise before posting.