The answer is found in specialfunctions.cpp file, at line 6749:
Code:
if( ((n<0||ae_fp_less(x,(double)(0)))||[b]ae_fp_greater(x,(double)(170)))[/b]||(ae_fp_eq(x,(double)(0))&&n<2) )
{
result = (double)(-1);
return result;
}
When the function
exponentialintegralen is used with invalid parameters (x<0 or n<0), it returns (-1) to show that input parameters are out of the validity domain. Correct.
But the middle expression:
Code:
ae_fp_greater(x,(double)(170))
in the test must not be here.
The correct code can be found in the CEPHES script (where MAXLOG would be 170):
Code:
/* Cephes Math Library Release 2.8: June, 2000
Copyright 1985, 2000 by Stephen L. Moshier */
if( x > MAXLOG )
return( 0.0 );
Why has this original CEPHES code been changed?