Dear staff of GNU

  I found bugs on GSL Extensions/Applications Fresnel by Andrew Steiner.
 This program does not return a correct value, if x is negative.

The original function fresnel_c is coded as,

double fresnel_c(double x)
{
  double xx = x*x*pi_2;
  double ret_val;
  if(xx<=8.0)
   ret_val = fresnel_cos_0_8(xx);
  else
   ret_val = fresnel_cos_8_inf(xx);
  return (x<0.0) ? -ret_val : ret_val;
}
.

 I think it should be coded as,

double fresnel_c(double x)
{
  double xx = x*x*pi_2;
  double ret_val;
  double sign;

  if(xx < 0.0){
    xx*=-1.0;
    sign=-1.0;
  }
  else{
    sign=1.0;
  }

  if(xx<=8.0)
   ret_val = fresnel_cos_0_8(xx);
  else
   ret_val = fresnel_cos_8_inf(xx);

  ret_val*=sign;

  return(ret_val);
}
.

The same correction should be done on the function fresnel_s.

Sincerely yours,
Toshiro Ohsaki
from Tokyo Japan.
_______________________________________________
Bug-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gsl

Reply via email to