paulmasson/math

replace isComplex(x) with isComplex(result)

axkr opened this issue · 3 comments

axkr commented

if ( isComplex(x) ) return result;

Should the pattern

if ( isComplex(x) ) return result;

be replaced with

if ( isComplex(result) ) return result;

in the functions cosIntegral, coshIntegral, sinIntegral, sinhIntegral ?

No: result is always complex because of the intermediate logarithms of negative numbers. For real input the imaginary part is zero and should be discarded.

My bad: cosIntegral and coshIntegral are both complex for negative real arguments. Fixed in cd9d18e. Let me know if you find other problematic cases, otherwise closing again.