3

I know that for very long ints there is int64. Is there something similar for very long doubles? I want to save a number with a very big precision.

lital maatuk
  • 5,921
  • 20
  • 57
  • 79
  • There is a _float128 type in newer gcc which is software floating point with <= 128 bit precision – osgx Feb 03 '12 at 13:24

3 Answers3

5

long double is the largest standard type. If this isn't enough, you'll need a bignum library (e.g. GMP)

Erik
  • 88,732
  • 13
  • 198
  • 189
3

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.

Community
  • 1
  • 1
Tom
  • 5,219
  • 2
  • 29
  • 45
3

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.

Scott
  • 16,711
  • 14
  • 75
  • 120