Orlando Andico wrote: > if i may ask a potentially stupid question. > > what is the use of "long double?" arguably, people who need numbers that > large would be using GMP or PARI.
AFAIK, on an x86 machine, a long double would be the ten-byte, 80-bit representation of floating point numbers that every x86 FPU since the 8087 has been using internally. It would have a 15-bit exponent a 64 bit mantissa, allowing one to represent numbers up to 10^4932 with up to 19 significant decimal digits. That sort of precision can be useful at times for sensitive calculations that would otherwise be prone to floating point underflow, catastrophic cancellation, precision loss, and the other ills of numerical analysts, and you can get it only at the cost of slightly more memory use and slightly slower floating point loads and stores to memory (a fld fword ptr would require at least two bus cycles on a 64-bit bus, more if the long double were not aligned on an 8-byte boundary). That's still a far, far cry from the penalty you get for using GMP or PARI, for which you would be doing all the computations without any specialized hardware assistance, and your numbers would also grow in memory usage without bound. While I've never had to do it myself, it's not difficult to imagine a scenario where the extra precision of a long double might be worth the penalties associated with it. After all, calculation internal to the FPU is the same regardless of whether you ultimately store the results in a 32-bit float, 64-bit double, or 80-bit long double. For the majority of applications using floating point, however, a double should be more than good enough. -- While there is a lower class, I am in it, while there is a criminal element, I am of it, and while there is a soul in prison, I am not free. http://stormwyrm.blogspot.com/ _________________________________________________ Philippine Linux Users' Group (PLUG) Mailing List [email protected] (#PLUG @ irc.free.net.ph) Read the Guidelines: http://linux.org.ph/lists Searchable Archives: http://archives.free.net.ph

