Task

Calculate the value of   e.



(e   is also known as   Euler's number   and   Napier's constant.)



See details: Calculating the value of e

*        Calculating the value of e - 21/07/2018
CALCE    PROLOG
         LE     F0,=E'0'
         STE    F0,EOLD            eold=0
         LE     F2,=E'1'           e=1
         LER    F4,F2              xi=1
         LER    F6,F2              facti=1
BWHILE   CE     F2,EOLD            while e<>eold
         BE     EWHILE             ~
         STE    F2,EOLD              eold=e
         LE     F0,=E'1'             1
         DER    F0,F6                1/facti
         AER    F2,F0                e=e+1/facti
         AE     F4,=E'1'             xi=xi+1
         MER    F6,F4                facti=facti*xi
         LER    F0,F4                xi
         B      BWHILE             end while
EWHILE   LER    F0,F2              e
         LA     R0,5               number of decimals
         BAL    R14,FORMATF        format a float number
         MVC    PG(13),0(R1)       output e
         XPRNT  PG,L'PG            print e
         EPILOG
         COPY   FORMATF            format a float number
EOLD     DS     E                  eold
PG       DC     CL80' '            buffer
         REGEQU
         END    CALCE 