Re: Reg: gcc option for printing large number (large double)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2013-09-16 11:46:43 +0200, Vincent Lefevre wrote:
> On 2013-09-15 20:37:51 -0400, Tim Prince wrote:
> > On 9/15/2013 3:42 PM, Arbol One wrote:
> > >Use a 'long long' value instead of a 'double'.
>           ^^^^^^^^^
> long double
> 
> > >
> > >#include <iostream>
> > >#include <math.h>
> > >
> > >using namespace std;
> > >int main() {
> > >        long long temp = 0.0;
>            ^^^^^^^^^
> long double
> 
> > >        temp = pow(2, 2000);
> > >        cout << "The value of tmp is: " << temp << endl;
> > >
> > >        return 0;
> > >}
> > >
> > :s/pow/powl/
> > but not all math libraries invoked by some gcc implementations will work.
> 
> And on some platforms (ARM, PowerPC), "long double" has the same range
> of "double".

I forgot to say... If long double is not sufficient, you can
consider GNU MPFR. The maximum exponent is around 2^30 by default,
and it can be increased to 2^62 on 64-bit machines.

There's also DPE <https://gforge.inria.fr/projects/dpe/> but AFAIK,
it doesn't support many functions.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux