# # 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-18: atanh(x) ; Conditions: -1 < x < 1 ; Accuracy: 10 digits ; Color: green ; Style: blank ; ---------- Card-Pocket-End --------------------------------------------- ; ; http://en.wikipedia.org/wiki/Hyperbolic_function ; ; Calculated using the formula ; ; atanh(x) = 0.5 * ln((1 + x) / (1 - x)) ; ; M14 => sign of result ; M13 => |x| ; M12 => y**2 ; M11 => series sum ; M10 => odd denominator ; SFJ $304 SM13 MJ $406 1 SM14 RV UJ $407 FJ $406 1 CS SM14 RV CS FJ $407 1 -= / 2 RV -= 1 -= SQRT SQRT SQRT SQRT 1 += / 2 RV -= 1 SM10 += ; "y" SM13 SM11 * += ; y**2 SM12 FJ $408 2 M10 RM13 * RM12 / SM13 RM10 += M11 ; add to series sum CS MJ $408 RM11 * 16 ; compensate for the 4 sqrt, above * RM14 ; sign of the result += SRJ