(50G) EXP(n) or e^n, with n integer & |n|<1152, result with 395 correct digits

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (https://www.hpmuseum.org/forum/forum-10.html)
+--- Forum: General Software Library (https://www.hpmuseum.org/forum/forum-13.html)
+--- Thread: (50G) EXP(n) or e^n, with n integer & |n|<1152, result with 395 correct digits (/thread-23814.html)



(50G) EXP(n) or e^n, with n integer & |n|<1152, result with 395 correct digits - Gil - 2025-07-17

Gives n as unique argument, then press expN. 

Result with 395 correct digits. 

Code for expN
\<< "1 Arg: n
(integer \<= 1151)
" DROP DUP DUP "e^" SWAP R\->I + ", 395d" + SWAP EXP \->NUM 2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934884167509244761460668082264800168477411853742345442437107539077744992069551702761838606261331384583000752044933826560297606737113200709328709127443747047230696977209310141 DUP \-> e
  \<< 1 5 ROLL 1 -
    START e * \->STR 1 400 SUB OBJ\->
    NEXT \->STR 1 395 SUB OBJ\->
  \>>
\>>

Example: e^1151

Input: 1151
Run expN

Result, after about 10 seconds with EMU48:
"e^1151, 395d" 
7.46360540686E499 74636054068595484054856883440572157831172077682341197474016136095193821746694995752712616296161883787986548812248088170345753659146918363328792604974958040612370270782842630252412580310518320155908649508924341176497375853189585762998345612151829771052432264543209399321702870835339185256461503984047999963066963415228279489802674166657971070085516719653114506897205447751710412025862342246247780