# # 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 . # ; Group Function card set 1 ; ; ------------------ Card-Pocket-Begin ----------------------------------- ; Title: GF-1: sin(x), cos(x), tan(x), pi ; Color: green ; Style: blank ; ------------------ Card-Pocket-End ------------------------------------- ; ; [LRN] program cards ; [OPE] data cards ; [UJ] [1] => sin(x) ; [UJ] [2] => cos(x) ; [UJ] [3] => tan(x) ; [UJ] [4] => pi ; ; [UJ] [1] 30 [START] => 0.500000000000000 ; [UJ] [2] 60 [START] => 0.500000000000000 ; [UJ] [3] 45 [START] => 1.000000000000000 ; [UJ] [4] => 3.141592653589793 ; ; -------------------------------------------------------------------------- ; ; Interestingly, this program doesn't use the MS-01 sin(x) subroutine. ; SFJ $614 / 360 * SM8 1 FLOOR 0 ; this rounds towards zero (not quite the Unix floor(x) func) -= RM8 += ; -1 < x < 1 * 4 += ; -4 < x < 4 MJ $614 FJ $613 ; 0 <= x < 4 SM8 1 -= MJ $612 2 -= MJ $611 4 CS M8 FJ $612 RM8 * += SM7 * RM9 += RM10 += * RM7 += RM11 += * RM7 += RM12 += * RM7 += RM13 += * RM7 += RM14 += * RM8 += SRJ FJ $614 4 += UJ $613 FJ $611 1 += CS SM8 UJ $612 ; sine FJ 1 ENT ; input, degrees SUJ $614 * 1 ROUND $710 ; round to 10 decimal places += PRINT ; print the result UJ 1 ; repeat ; cosine FJ 2 ENT ; input, degrees SM6 90 ; add 90 degrees += SUJ $614 ; calculate sine { because cos(x) = sin(x + pi/2) } * 1 ROUND $710 ; round to 10 decimal places += PRINT ; print the result UJ 2 ; repeat ; tangent FJ 3 ENT ; input, degrees SM6 ; remember the angle 90 += ; add 90 degrees SUJ $614 ; calculate sin(x+90) = cos(x) RM6 ; get back forst angle RV SM6 ; remember cos(x) RV SUJ $614 ; calculate sin(x) / RM6 ; tan(x) = sin(x) / cos(x) += ; (why doesn't it round to 10 places?) PRINT ; print the result UJ 3 ; repeat ; pi FJ 4 3.141592653589793 SM6 PRINT ENT