exp-int ( x -- y )


Vocabulary
math.analysis

Inputs
xa number


Outputs
ya number


Word description
Exponential integral function.

Notes
Works only for real values of x and is accurate to 7 decimal places.

Definition


: exp-int ( x -- y )
dup 1.0 < [
dup 0.00107857 * 0.00976004 - over * 0.05519968 + over *
0.24991055 - over * 0.99999193 + over * 0.57721566 -
swap log -
] [
dup 8.5733287401 + over * 18.059016973 + over *
8.6347608925 + over * 0.2677737343 +
over dup 9.5733223454 + over * 25.6329561486 + over *
21.0996530827 + over * 3.9584969228 + nip / over /
swap -1.0 * e^ *
] if ;