# # 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-17: acosh(x) ; Color: green ; Style: blank ; ---------- Card-Pocket-End --------------------------------------------- ; ; http://en.wikipedia.org/wiki/Hyperbolic_function ; ; Evaluated using the formula ; ; acosh(x) = ln(x + sqrt(x**2 - 1)) ; SFJ $303 SM14 ; x * += 1 -= SQRT RM14 += ; x + sqrt(x**2 - 1) SQRT ; this next is similar to the MS-12 ln(x) code SQRT SQRT SQRT ; ; M14 => previous numerator ; M13 => y**2 ; M12 => series sum ; M11 => odd denominator ; 1 ; 1 - 2 / (x + 1) += ; is the same as / ; (x - 1) / (x + 1) 2 RV -= 1 SM11 ; odd denominator += ; "y" = (x - 1) / (x + 1) SM14 ; previous numerator SM12 ; series sum * += SM13 ; y**2 FJ $405 2 ; bump denominator M11 RM14 ; previous numerator * RM13 ; y**2 / SM14 ; save numerator RM11 ; odd denominator += M12 ; add to series sum CS MJ $405 RM12 * 32 ; cope with those 4 sqrt, above, and the missing 2* += SRJ