;
; Computes e^x via the formula 2 ^ (x * log2 (e))
;

FLDL2E                  ; ST0 = log2 (e)                                <-- Load log2 (e)
                        ;
FMUL [X]                ; ST0 = x * log2 (e)                            <-- Read x from memory
                        ;
FLD1                    ; ST0 = 1                                       <-- Load 1
                        ; ST1 = x * log2 (e)
                        ;
FLD ST1                 ; ST0 = x * log2 (e)                            <-- Make copy of intermediate result
                        ; ST1 = 1
                        ; ST2 = x * log2 (e)
                        ;
FPREM                   ; ST0 = partial_remainder ((x * log2 (e)) / 1)  <-- Let's call this "rem"
                        ; ST1 = 1
                        ; ST2 = x * log2 (e)
                        ;
F2XM1                   ; ST0 = 2 ^ (rem) - 1
                        ; ST1 = 1
                        ; ST2 = x * log2 (e)
                        ;
FADDP ST1, ST0          ; ST0 = 2 ^ (rem) - 1 + 1 = 2 ^ (rem)
                        ; ST1 = x * log2 (e)
                        ;
FSCALE                  ; ST0 = 2 ^ (rem) * 2 ^ (trunc (x * log2 (e)))
                        ; ST1 = x * log2 (e)
                        ;
FSTP ST1                ;                                               <-- The result is left in ST0
