help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Seeking the fastest numerical library for quadruple preci


From: Jordi Gutierrez Hermoso
Subject: Re: [Help-gsl] Seeking the fastest numerical library for quadruple precision in C/C++/Fortran
Date: Sat, 7 Jul 2007 19:45:04 -0500

Hi, Michael.

Your post may be a tad offtopic. Detailed discussions of proprietary
software like Matlab, Mathematica, and all the other proprietary
software you mentioned are probably not appropriate in this list, save
perhaps for comparisons with free software. Others may disagree with
me, though.

On 03/07/07, Michael <address@hidden> wrote:
I guess quadruple precision exactly fits my problem and should be
much faster than double precision.

How can quadruple precision make anything faster than the same
algorithm with doubles? I don't follow.

Btw, there are very, very few instances where the way to solve a
problem is to increase the precision of calculations. If roundoff
error is creeping up on you, using higher precision only postpones the
real problem, but doesn't fix it. I'm curious to see what kind of
problem you think needs quad precision to be solved where doubles
won't do.

Moreover, do GSL,
...
have got quadruple precision support? I only need +, -, *, /, exp,
and log.

The GSL doesn't support quadruple precision simply because C doesn't
support quadruple precision. As pointed out earlier, it's hardware
dependant. You can use C/C++ long doubles if you need more precision,
but it doesn't look like a long double is long enough to give you
quad precision. On my machine, the code

   #include <iostream>

   int main(){
     using namespace std;
     cout << "sizeof(double): " << sizeof(double) << endl
           << "sizeof(long double): " << sizeof(long double) << endl;
   }

gives the output

    sizeof(double): 8
    sizeof(long double): 12

so there you have it. There's primitive type with more precision in
C/C++ than a long double. I should remark that there is no guarantee
that a C/C++ long double will have more precision than a double,
although it often does. This is again hardware-dependent and dependent
on the compiler's implementation.

There may be quad precision available in software, not hardware, but
this will probably suffer a substantial performance penalty.

But if you know how to "simulate" quadruple precision in Matlab or Maple, or
Mathematica,

In Maxima, you can set the number of digits of precision by using
so-called bigfloats and setting the number of decimal digits you want
to use in the fpprec variable:

   (%i1) fpprec : 32;
                                         32
   (%i2) bfloat(%pi);
                         3.1415926535897932384626433832795b0
   (%i3) fpprec : 64;
                                         64
   (%i4) bfloat(%pi);
         3.141592653589793238462643383279502884197169399375105820974944592b0

I don't remember how the proprietary software you mentioned does it.

Moreover, are there popular quadruple precision packages? Please recommend
the fastest one. I am really in huge need of speed.

Again, how do you expect that using quad precision instead of double could
possibly speed anything up? Is there something I'm misunderstanding?

Cheers,
- Jordi G. H.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]