Skip to content

Commit

Permalink
expIntegralEi around origin
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmasson committed Apr 7, 2022
1 parent 8ecb6f1 commit a049049
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion build/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -2229,7 +2229,9 @@ function expIntegralEi( x, adjustImForGamma=false, tolerance=1e-10 ) {
var distanceScale = abs( sub(x,useAsymptotic) ) / useAsymptotic;
var useArbitrary = distanceScale > 1;

if ( useArbitrary ) {
// arbitrary precision series is unstable around the origin but not needed

if ( useArbitrary && abs(x) > 1.5 ) {

// use only decimals needed
var n = 17 + Math.round( 10 * ( distanceScale - 1 ) );
Expand Down
4 changes: 3 additions & 1 deletion src/functions/gamma.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,9 @@ function expIntegralEi( x, adjustImForGamma=false, tolerance=1e-10 ) {
var distanceScale = abs( sub(x,useAsymptotic) ) / useAsymptotic;
var useArbitrary = distanceScale > 1;

if ( useArbitrary ) {
// arbitrary precision series is unstable around the origin but not needed

if ( useArbitrary && abs(x) > 1.5 ) {

// use only decimals needed
var n = 17 + Math.round( 10 * ( distanceScale - 1 ) );
Expand Down

0 comments on commit a049049

Please sign in to comment.