bug-gsl
[Top][All Lists]
Advanced

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

[Bug-gsl] testing gsl_log1p when gsl_log1p is not used


From: Eugene Loh
Subject: [Bug-gsl] testing gsl_log1p when gsl_log1p is not used
Date: Fri, 20 Jul 2007 17:01:04 -0700
User-agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.7) Gecko/20041221

(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.




reply via email to

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