Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: PowerPC Numerics /


Figures, Tables, and Listings

Preface About This Book xvii

Chapter 1 IEEE Standard Arithmetic 1-1

Table 1-1 Approximation of real numbers 1-4

Listing 1-1 Inverse operations 1-6

Figure 1-1 Parallel resistances 1-9

Figure 1-2 Graph of continued fraction functions cf(x) and rf(x) 1-10

Table 1-2 Area using Heron's formula 1-11

Chapter 2 Floating-Point Data Formats 2-1

Figure 2-1 IEEE single format 2-3

Table 2-1 Names of data types 2-4

Figure 2-2 Normalized single-precision numbers on the number line 2-5

Figure 2-3 Denormalized single-precision numbers on the number line 2-6

Table 2-2 Example of gradual underflow 2-7

Figure 2-4 Infinities represented in single precision 2-8

Table 2-3 NaN codes 2-9

Figure 2-5 NaNs represented in single precision 2-10

Figure 2-6 Zeros represented in single precision 2-11

Table 2-4 Symbols used in format diagrams 2-11

Figure 2-7 Single format 2-12

Figure 2-8 Single-format floating-point numbers on the real number line 2-12

Table 2-5 Values of single-format numbers (32 bits) 2-12

Figure 2-9 Double format 2-13

Table 2-6 Values of double-format numbers (64 bits) 2-13

Figure 2-10 Double-format floating-point values on the real number line 2-14

Figure 2-11 Double-double format 2-14

Figure 2-12 Double-double format number example 2-15

Table 2-7 Summary of PowerPC Numerics data formats 2-16

Chapter 3 Expression Evaluation 3-1

Figure 3-1 Evaluating complex expressions without widest need 3-5

Figure 3-2 Evaluating complex expressions with widest need 3-7

Figure 3-3 Evaluating an expression with a function call 3-9

Figure 3-4 Evaluating an expression with arithmetic operations 3-10

Chapter 4 Environmental Controls 4-1

Table 4-1 Examples of rounding to integer in different directions 4-4

Chapter 5 Conversions 5-1

Table 5-1 Examples of floating-point to integer conversion 5-4

Table 5-2 Double to single conversion: Possible exceptions 5-5

Figure 5-1 Single to double-double conversion 5-6

Figure 5-2 Double-double to single conversion 5-6

Table 5-3 Double-double to single conversion: Possible exceptions 5-7

Figure 5-3 Conversion cycle with first-time error 5-8

Figure 5-4 Conversion cycle with correct result 5-9

Chapter 6 Numeric Operations and Functions 6-1

Table 6-1 Comparison symbols 6-4

Table 6-2 Arithmetic operations in C 6-5

Table 6-3 Special cases for floating-point addition 6-6

Table 6-4 Special cases for floating-point subtraction 6-7

Table 6-5 Special cases for floating-point multiplication 6-8

Table 6-6 Special cases for floating-point division 6-9

Table 6-7 Special cases for floating-point square root 6-11

Figure 6-1 Integer-division algorithm 6-12

Table 6-8 Special cases for floating-point remainder 6-12

Table 6-9 Special cases for floating-point round-to-integer 6-14

Table 6-10 Examples of rint 6-14

Chapter 7 Numeric Data Types in C 7-1

Table 7-1 Names of data types 7-3

Table 7-2 float_t and double_t types 7-3

Table 7-3 Class and sign inquiry macros 7-4

Chapter 8 Environmental Control Functions 8-1

Table 8-1 Rounding direction modes in MathLib 8-3

Table 8-2 Floating-point exception flags in MathLib 8-6

Chapter 9 Conversion Functions 9-1

Table 9-1 Special cases for the rinttol function 9-4

Table 9-2 Special cases for the roundtol function 9-5

Table 9-3 Special cases for the ceil function 9-7

Table 9-4 Special cases for the floor function 9-8

Table 9-5 Special cases for the nearbyint function 9-9

Table 9-6 Special cases for the round function 9-11

Table 9-7 Special cases for the trunc function 9-12

Table 9-8 Format of decimal output string in floating style 9-15

Table 9-9 Format of decimal output string in fixed style 9-15

Listing 9-1 Accounting program 9-21

Listing 9-2 Scanning algorithm 9-22

Table 9-10 Examples of conversions to decimal structures 9-23

Chapter 10 Transcendental Functions 10-1

Table 10-1 Special cases for the fdim function 10-4

Table 10-2 Special cases for the fmax function 10-6

Table 10-3 Special cases for the fmin function 10-7

Table 10-4 Special cases for the relation function 10-8

Table 10-5 Special cases for the copysign function 10-10

Table 10-6 Special cases for the fabs function 10-11

Table 10-7 Special cases for the exp function 10-13

Table 10-8 Special cases for the exp2 function 10-14

Table 10-9 Special cases for the expm1 function 10-15

Table 10-10 Special cases for the ldexp function 10-16

Table 10-11 Special cases for the pow function 10-18

Table 10-12 Special cases for the scalb function 10-21

Table 10-13 Special cases for the frexp function 10-22

Table 10-14 Special cases for the log function 10-23

Table 10-15 Special cases for the log10 function 10-26

Table 10-16 Special cases for the log1p function 10-27

Table 10-17 Special cases for the log2 function 10-28

Table 10-18 Special cases for the logb function 10-30

Table 10-19 Special cases for the modf function 10-31

Table 10-20 Special cases for the cos function 10-33

Table 10-21 Special cases for the sin function 10-35

Table 10-22 Special cases for the tan function 10-36

Table 10-23 Special cases for the acos function 10-37

Table 10-24 Special cases for the asin function 10-38

Table 10-25 Special cases for the atan function 10-39

Table 10-26 Special cases for the atan2 function 10-41

Table 10-27 Special cases for the cosh function 10-43

Table 10-28 Special cases for the sinh function 10-44

Table 10-29 Special cases for the tanh function 10-45

Table 10-30 Special cases for the acosh function 10-46

Table 10-31 Special cases for the asinh function 10-47

Table 10-32 Special cases for the atanh function 10-50

Table 10-33 Special cases for the compound function 10-51

Table 10-34 Special cases for the annuity function 10-54

Table 10-35 Special cases for the erf function 10-56

Table 10-36 Special cases for the erfc function 10-57

Table 10-37 Special cases for the gamma function 10-58

Table 10-38 Special cases for the lgamma function 10-59

Table 10-39 Special cases for the nextafter functions 10-61

Table 10-40 Special cases for the hypot function 10-63

Chapter 11 Introduction to Assembly-Language Numerics 11-1

Table 11-1 Load and store floating-point instructions 11-6

Listing 11-1 Polynomial evaluation 11-8

Chapter 12 Assembly-Language Environmental Controls 12-1

Figure 12-1 Floating-Point Status and Control Register (FPSCR) 12-3

Table 12-1 Bit assignments for FPSCR fields 12-4

Figure 12-2 Condition Register 12-5

Table 12-2 Branch instructions using the Condition Register 12-6

Table 12-3 Values for FPSCR bits 15 through 19 12-7

Listing 12-1 Determining the class of an assembler instruction result 12-8

Table 12-4 Rounding direction bits in the FPSCR 12-9

Table 12-5 Floating-point exception bits in the FPSCR 12-10

Listing 12-2 Testing for occurrence of floating-point exceptions 12-13

Figure 12-3 SRC and DST fields for mtfsf instruction 12-15

Listing 12-3 Saving and restoring the floating-point environment 12-15

Chapter 13 Assembly-Language Numeric Conversions 13-1

Listing 13-1 Converting a number from integer format to floating-point format 13-4

Chapter 14 Assembly-Language Numeric Operations 14-1

Appendix A SANE Versus PowerPC Numerics A-1

Table A-1 Class and sign inquiries in SANE versus MathLib A-6

Table A-2 Environmental access functions in SANE versus MathLib A-7

Listing A-1 Using environmental controls in SANE and PowerPC Numerics A-8

Table A-3 float_t and double_t definitions A-9

Appendix B Porting Programs to PowerPC Numerics B-1

Appendix C MathLib Header Files C-1

Appendix D FPCE Recommendations for Compilers D-1

Appendix E MathLib Reference E-1

Figure E-1 Floating-point data formats E-1

Table E-1 Interpreting floating-point values E-2

Table E-2 Class and sign inquiry macros E-2

Table E-3 Environmental access E-3

Table E-4 Floating-point exceptions E-3

Table E-5 Rounding direction modes E-3

Table E-6 Arithmetic operations E-4

Table E-7 Conversions to integer type E-4

Table E-8 Conversions to integer in floating-point type E-4

Table E-9 Conversions between binary and decimal formats E-5

Table E-10 Conversions between decimal formats E-6

Table E-11 Comparison operations E-6

Table E-12 Sign manipulation functions E-6

Table E-13 Exponential functions E-6

Table E-14 Logarithmic functions E-7

Table E-15 Trigonometric functions E-7

Table E-16 Hyperbolic functions E-8

Table E-17 Financial functions E-8

Table E-18 Error and gamma functions E-8

Table E-19 Miscellaneous functions E-8

Appendix F PowerPC Assembly-Language Numerics Reference F-1

Figure F-1 Floating-point data formats F-1

Table F-1 Interpreting floating-point values F-1

Table F-2 Bit assignments for FPSCR fields F-2

Table F-3 Rounding direction bits in the FPSCR F-3

Table F-4 Class and sign inquiry bits in the FPSCR F-3

Table F-5 FPSCR instructions F-4

Table F-6 Load instructions F-4

Table F-7 Store instructions F-5

Table F-8 Conversions to integer format F-5

Table F-9 Conversions from double to single format F-5

Table F-10 Comparison instructions F-5

Table F-11 Arithmetic instructions F-6

Table F-12 Multiply-add instructions F-6

Table F-13 Move instructions F-6


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996