# TITLE: Check & Repair Rounding Errors # AUTHOR: Roy F.A. Maclean # EMAIL: rfamgm at gmail # WEB: http://www.spiderpixel.co.uk/caspro # DATE: 27Sep1996 # MAKE: CASIO # MODEL: fx6300 or greater # SIZE: 59 # # 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. # However it could be useful as a subroutine of an existing 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 # The line with 1 \10^ -6 determines the rounding level @@ Program 2 Ans->P Abs P->R Int R->S Frac R>=.5=>Isz S R<>0=>PS/R->T R=0=>0->T Abs (T-P)<1 \10^ -6=>T->P P