# TITLE: Check & Repair Complex Rounding Errors # AUTHOR: Roy F.A. Maclean # EMAIL: rfamgm at gmail # WEB: http://www.spiderpixel.co.uk/caspro # DATE: 19Sep1996 # MAKE: CASIO # MODEL: fx9700 or greater # SIZE: 100 # # This program rounds things if they are very near a whole number. # examples: # 1.675 stays as 1.675 # 1.9999999 becomes 2 # 1.0000001 becomes 1 # 1.E-12 becomes 0 # 6.E-7 -2.00000005i becomes -2i # # On its own this program doesn't do anything. # It is useful as a subroutine of an existing program. # For instance it is used in my 'cubic with complex coeffs' program. # It takes the value held in 'Ans' and checks it for round off errors. # It then compensates for the error and ends by changing the value # held in 'Ans' accordingly. # # \10^ is the small 10 above the log button # \i is the complex i # # The line with 1 \10^ -6 determines the rounding level @@ Program 1 ReP Ans->P:ImP Ans->Q 0->U:Lbl 0 Abs P[U]->R Int R->S Frac R>=.5=>Isz S R<>0=>P[U]S/R->T R=0=>0->T Abs (T-P[U])<1 \10^ -6=>T->P[U] Isz U:U=1=>Goto 0 P+\iQ