# # 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: Cube Root, by P. Miller ; Style: aus ; Disassemble: true ; ---------- Card-Pocket-End --------------------------------------------- ; ; This subroutine uses the Newton-Raphson method to find the cube root ; of the number in the X register. ; ; x2 = (2 * x1 + a / (x1 * x1)) / 3 ; ; a => m14 ; x => m13 ; sfj $210 sm14 sqrt sqrt ; first approximation is 4th root sm13 fj $210 rm13 * += / rm14 rv += rm13 += rm13 += / 3 += rm13 rv sm13 -= * .1 += mj $210 sc mj $210 rm13 srj