#
# canola - canon canola 1614p emulator
# Copyright (C) 2011 Peter Miller
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 3, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see .
#
; ---------- Card-Pocket-Begin -------------------------------------------
; Title: MS-9: 10**x
; Color: green
; Style: blank
; ---------- Card-Pocket-End ---------------------------------------------
;
; This subroutine uses the following Taylor series for exp(x)
;
; e**x = sigma((x**n)/(n!))
; = 1 + x + (x**2)/2 + (x**3)/6 + ...
;
; but it actually calculates the square root of the answer, and then
; squares the result. I wonder if this is an error to improve the
; number of decimals of accuracy.
;
SFJ $209
*
1.151292546497 ; = ln(10)/2
+=
SM11 ; x
SM12 ; series sum (just x here)
SM13
1
SM14 ; running factorial
M12 ; add to series sum (now it's 1+x)
FJ $306
1
M14 ; bump factorial denominator
RM13 ; previous term
*
RM11 ; x
/
RM14 ; factorial denominator
+=
SM13
M12 ; add to series sum
MJ $306
SC
MJ $306
RM12
*
+=
SRJ