Morgan - Numerical Methods (523161), страница 2
Текст из файла (страница 2)
123What To Expect ....................................................................................... 124A Small Floating-Point Package................................................................ 127The Elements of a Floating-Point Number.............................................. 128Extended Precision ............................................................................ 131The External Routines .................................................................................
132fp_add: Algorithm ............................................................................. 132fp_add: Listing................................................................................. 133The Core Routines........................................................................................ 134Fitting These Routines to an Application...................................................... 136Addition and Subtraction: FLADD..............................................................
136FLADD: The Prologue. Algorithm...................................................... 138FLADD: The Prologue. Listing.......................................................... 138The FLADD Routine Which Operand is Largest? Algorithm.............. 140The FLADD Routine: Which Operand is Largest? Listing.................... 141CONTENTSThe FLADD Routine: Aligning the Radix Points. Algorithm................. 142The FLADD Routine: Aligning the Radix Point. Listing ....................
143FLADD: The Epilogue. Algorithm..................................................... 144FLADD: The Epilogue. Listing ........................................................... 145Multiplication and Division: FLMUL..........................................................flmul: Algorithm .................................................................................flmul: Listing ....................................................................................mu164a: Algorithm ...........................................................................mu164a: Listing .................................................................................FLDIV...............................................................................................fldiv: Algorithm..................................................................................fldiv: Listing ......................................................................................Rounding .....................................................................................................Round: Algorithm...............................................................................Round: Listing ...................................................................................147147148151152154154155159159160CHAPTER 5: INPUT, OUTPUT, AND CONVERSION.......
........163Decimal Arithmetic ...................................................................................... 164Radix Conversions ...................................................................................... 165Integer Conversion by Division................................................................... 165bn_dnt: Algorithm .............................................................................. 166bn_dnt: Listing ...................................................................................
167Integer Conversion by Multiplication........................................................... 169dnt_bn: Algorithm.............................................................................. 170dnt_bn: Listing ................................................................................... 170Fraction Conversion b y Multiplication .......................................................... 172bfc_dc: Algorithm............................................................................... 173bfc_dc: Listing .................................................................................... 173NUMERICAL METHODSFraction Conversion by Division ..................................................................
175Dfc_bn: Algorithm ............................................................................. 176Dfc_bn: Listing .................................................................................. 177Table-Driven Conversions............................................................................Hex to ASCII ..............................................................................................hexasc: Algorithm.............................................................................hexasc: Listing ..................................................................................Decimal to Binary ......................................................................................tb_dcbn: Algorithm ............................................................................tb_dcbn: Listing ..................................................................................Binary to Decimal.......................................................................................tb_bndc: Algorithm............................................................................tb_bndc: Listing ..................................................................................Floating-Point Conversions..........................................................................ASCII to Single-Precision Float...................................................................atf: Algorithm ....................................................................................atf: Listing .........................................................................................Single-Precision Float to ASCII...................................................................fta: Algorithm ....................................................................................Fta: Listing .........................................................................................Fixed Point to Single-Precision Floating Point .............................................ftf: Algorithm .....................................................................................ftf: Listing ........................................................................................Single-Precision Floating Point to Fixed Point .............................................ftfx Algorithm ..................................................................................ftfx: Listing .......................................................................................179179180180182182184187188189192192193195200200202206207208211212212CONTENTSCHAPTER 6: THE ELEMENTARY FUNCTIONS ....................Fixed Point Algorithms ..............................................................................Lookup Tables and Linear Interpolation......................................................lg 10: Algorithm ...............................................................................lg 10: Listing ....................................................................................Dcsin: Algorithm ............................................................................Dcsin: Listing ..................................................................................Computing With Tables .............................................................................Pwrb: Algorithm ..............................................................................Pwrb: Listing ...................................................................................CORDIC Algorithms.................................................................................Circular: Algorithm ............................................................................Circular: Listing ................................................................................Polynomial Evaluations ...........................................................................taylorsin: Algorithm .......................................................................taylorsin: Listing .............................................................................Polyeval: Algorithm...........................................................................Polyeval: Listing ...............................................................................Calculating Fixed-Point Square Roots........................................................fx_sqr: Algorithm .............................................................................fx_sqr: Listing ..................................................................................school_sqr: Algorithm ......................................................................school_sqr: Listing ..............................................................................Floating-Point Approximations ...................................................................Floating-Point Utilities ...............................................................................frxp: Algorithm ..................................................................................frxp: Listing ......................................................................................ldxp: Algorithm.................................................................................ldxp: Listing......................................................................................217217217219220224227233234235237242242247249250251251253254254256257259259259260261261NUMERICAL METHODS263flr: Algorithm ...........................................................................................263flr: Listing .................................................................................................265flceil: Algorithm ......................................................................................266flceil: Listing ............................................................................................268intmd: Algorithm....................................................................................268intmd: Listing ...........................................................................................269Square Roots ......................................................................................................270Flsqr: Algorithm.......................................................................................271Flsqr: Listing ............................................................................................273Sines and Cosines...............................................................................................274flsin: Algorithm........................................................................................275Flsin: Listing............................................................................................APPENDIXES:A: A PSEUDO-RANDOM NUMBER GENERATOR ....................
2 8 1B: TABLES AND EQUATES ............................................295C: FXMATH.ASM ............................................................. 297D: FPMATH.ASM .......................................................... 337E: IO.ASM . . . . . . . . . . . . . . . . . .