REM Expo .... Rev 2.0
      REM A J Tooth // October 2015
 
      *FLOAT64
      MODE 14 : OFF : COLOUR 132,50,0,0 : COLOUR 132 : CLS
 
      INPUT TAB(5,5);"Enter a value; ";X
 
      ResB = EXP(X)
 
      PRINT TAB(5,5);"BBC version of EXP(";X;")=";ResB
 
      Res = FN_EXP(1.0*X)
 
      PRINT TAB(5,10);"ASM version of EXP(";X;")= ";Res
 
      a$=GET$
      QUIT
      REM End of Program ===============================================
      REM ==============================================================
 
      REM Exponential routine
      DEF FN_EXP(X#)
      LOCAL Res#
      PRIVATE xpo%,P%,opt&
 
      IF xpo% = 0 THEN
 
        DIM xpo% 100
 
        FOR opt& = 0 TO 2 STEP 2
 
          P% = xpo%
 
          [opt opt&
 
          finit
          mov esi,[ebp+2]
          fld qword [esi]
 
          fldl2e
          fmulp st1,st0
          fld st0
          frndint
          fsub st1,st0
          fxch st1
          f2xm1
          fld1
          faddp st1,st0
          fscale
 
          mov esi,[ebp+7]
          fstp qword [esi]
 
          ret
          ]
        NEXT opt&
      ENDIF
 
      CALL xpo%, X#, Res#
 
      = Res#
      REM ====================================================================