# # 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-10: log10(x) ; Color: green ; Style: blank ; ---------- Card-Pocket-End --------------------------------------------- ; SFJ $210 SQRT ; The series converges faster when x is closer to 1. SQRT SQRT SQRT ; ; http://en.wikipedia.org/wiki/Natural_logarithm ; ; ln(x) = ln((1+y)/(1-y)) ; = 2y (1 + (y**2)/3 + (y**4)/5 + (y**6)/7 + (y**8)/9 + ... ) ; = 2 (y + (y**3)/3 + (y**5)/5 + (y**7)/7 + (y**9)/9 + ... ) ; ; where y = (x - 1) / (x + 1) ; ; M14 => odd denominator ; M13 => previous numerator ; M12 => series sum ; M11 => y**2 ; SM13 ; x (temporarily) 1 SM14 M13 ; m13 = x + 1 -= ; x - 1 / RM13 ; x + 1 += ; "y" = (x - 1) / (x + 1) SM13 ; first term numerator SM12 ; series sum * += SM11 ; y**2 FJ $307 2 M14 ; bump denominator RM13 ; previous numerator * RM11 ; y**2 / SM13 ; save numerator RM14 += M12 ; add to series sum MJ $307 CS MJ $307 RM12 ; correct for the sqrts above, and the missing 2* * ; and also convert from ln(x) to log10(x) 13.8974234209045 ; = 32/ln(10) += SRJ