(First of all, I'm a GSL neophyte.  Okay, enough apologizing.)

I'm trying to see how aggressive I can turn Sun Studio compiler optimizations on with GSL.

Here is one of my problems. Aggressive optimizations can bypass the intentions of gsl_log1p() in sys/log1p.c:

double gsl_log1p (const double x)
{
 volatile double y;
 y = 1 + x;
 return log(y) - ((y-1)-x)/y ;  /* cancels errors with IEEE arithmetic */
}

That's very nicely written, but an aggressive compiler can rewrite that as y-(1+x) and so you lose the impact of what you had hoped to accomplish with precomputing 1+x and assigning it to a volatile variable.

REQUEST #1: Ruggedize the computation yet further than is already done. E.g.,

double gsl_log1p (const double x)
{
 volatile double y, z;
 y = 1 + x;
 z = y - 1;
 return log(y) - (z-x)/y ;  /* cancels errors with IEEE arithmetic */
}

But there is another issue. The fact that gsl_log1p() wasn't generating the expected result shouldn't have been a problem in the first place. The system provides log1p() and gsl_log1p() is never actually even used. Despite that, "make check" and sys/test.c test the otherwise-never-used gsl_log1p().

REQUEST #2: Change the check procedures so that unused functions are not tested. E.g., when you "make check", have sys/test.c test only those gsl_*() functions that will actually be used by GSL.


_______________________________________________
Bug-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gsl

Reply via email to