very long double
I know that for very long ints there is int64. Is there something similar for very long doubles? I want to 开发者_StackOverflow中文版save a number with a very big precision.
long double
is the largest standard type. If this isn't enough, you'll need a bignum library (e.g. GMP)
Try this out http://gmplib.org/
GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers. There is no practical limit to the precision except the ones implied by the available memory in the machine GMP runs on. GMP has a rich set of functions, and the functions have a regular interface.
Have a look at:
What is the precision of long double in C++?
It depends upon the implementation.
I got a feeling there might be something in the new standard c++0x about long double, but I forget, will check shortly.
Edit: checked it, my bad, there is no change: long double is at least as good as double.
精彩评论