Numerical Computation Guide

Numerical Computation Guide

Numerical Computation Guide A Sun Microsystems, Inc. Business 2550 Garcia Avenue Mountain View, CA 94043 U.S.A. Part No.: 801-7639-10 Revision A, August 1994 1994 Sun Microsystems, Inc. 2550 Garcia Avenue, Mountain View, California 94043-1100 U.S.A. All rights reserved. This product and related documentation are protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or related documentation may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Portions of this product may be derived from the UNIX® and Berkeley 4.3 BSD systems, licensed from UNIX System Laboratories, Inc., a wholly owned subsidiary of Novell, Inc., and the University of California, respectively. Third-party font software in this product is protected by copyright and licensed from Sun’s font suppliers. RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the United States Government is subject to the restrictions set forth in DFARS 252.227-7013 (c)(1)(ii) and FAR 52.227-19. The product described in this manual may be protected by one or more U.S. patents, foreign patents, or pending applications. TRADEMARKS Sun, the Sun logo, Sun Microsystems, Sun Microsystems Computer Corporation, Solaris, are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and certain other countries. UNIX is a registered trademark of Novell, Inc., in the United States and other countries; X/Open Company, Ltd., is the exclusive licensor of such trademark. OPEN LOOK® is a registered trademark of Novell, Inc. PostScript and Display PostScript are trademarks of Adobe Systems, Inc. All other product names mentioned herein are the trademarks of their respective owners. All SPARC trademarks, including the SCD Compliant Logo, are trademarks or registered trademarks of SPARC International, Inc. SPARCstation, SPARCserver, SPARCengine, SPARCstorage, SPARCware, SPARCcenter, SPARCclassic, SPARCcluster, SPARCdesign, SPARC811, SPARCprinter, UltraSPARC, microSPARC, SPARCworks, and SPARCompiler are licensed exclusively to Sun Microsystems, Inc. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOKand Sun™ Graphical User Interfaces were developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements. X Window System is a product of the Massachusetts Institute of Technology. THIS PUBLICATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THIS PUBLICATION COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THE PUBLICATION. SUN MICROSYSTEMS, INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS PUBLICATION AT ANY TIME Please Recycle Contents Preface. xv 1. Introduction . 1 Solaris for SPARC. 1 Solaris for x86 . 2 Floating-Point Environment . 2 2. IEEE Arithmetic. 5 IEEE Arithmetic Model . 5 What Is IEEE Arithmetic? . 5 IEEE Formats . 7 Storage Formats . 7 Single Format . 8 Double Format . 10 Double Extended Format (SPARC Architecture) . 14 Double Extended Format (x86 Architecture) . 17 Ranges and Precisions in Decimal Representation . 21 iii Underflow. 25 Underflow Thresholds . 25 How Does IEEE Arithmetic Treat Underflow?. 26 Why Gradual Underflow? . 27 Error Properties of Gradual Underflow . 28 Two Examples of Gradual Underflow Versus Store 0 . 30 Does Underflow Matter?. 32 3. The Math Libraries . 33 Math Library. 33 Value-added Math Library . 35 Single, Double, and Long Double Precision . 37 IEEE Support Functions . 38 ieee_functions(3m) and ieee_sun(3m) . 38 ieee_values(3m) . 40 nonstandard_arithmetic() . 44 ieee_retrospective(). 44 Implementation Features of libm and libsunmath . 45 About the Algorithms . 46 Argument Reduction for Trigonometric Functions. 46 Data Conversion Routines . 47 Random Number Facilities. 48 libC Support Functions . 49 Base Conversion. 49 4. Exceptions and Signal Handling . 51 iv Numerical Computation Guide What Is an Exception? . 52 Notes for Table 4-1. 54 Exceptions and Signals . 56 libsunmath Support For IEEE Modes & Exceptions . 60 ieee_handler (3m) . 60 ieee_flags(3m). 64 5. Compile-Debug-Run . 69 Compile. 69 Code Generation Options. 71 Optimization Options . 72 Redefining libm and libsunmath Functions vs. -xlibmil 76 About Precision . 77 Debug . 78 A Few Useful Debugging Commands . 79 Using the Debuggers to Investigate an IEEE Exception . 83 Run . 89 . fix_libc_ (SPARC on SunOS 4.x only). 90 Exit Status of C Programs . 90 ieee_retrospective Function . 92 Nonstandard Arithmetic and Kernel Emulation (SPARC only) 93 Compiler Versions . 94 Optimizing Large Programs. 94 Contents v A. Examples. 97 IEEE Arithmetic . 97 Examining Stored IEEE hexadecimal Representations . 97 The Math Libraries . 100 Random Number Generator. 100 ieee_values . 107 Exceptions and Signal Handling . 110 ieee_flags - Rounding Direction . 110 ieee_flags - Accrued Exceptions . 112 ieee_handler - Trapping Exceptions . 117 ieee_handler - Abort on Exceptions. 127 Compile-Debug-Run . 128 B. SPARC Behavior and Implementation . 133 Floating-point Hardware . 133 Handling Subnormal Results . 136 Status and Control Registers . 136 Handling Floating-point Exceptions . 137 Handling Gradual Underflow . 138 The fpversion(1) Function — Finding Information about the FPU . 139 Floating-point Hardware—Disable/Enable. 140 C. x86 Behavior and Implementation. 143 D. Standards Compliance . 145 SVID History . 145 vi Numerical Computation Guide IEEE 754 History . 146 SVID Future Directions . 146 SVID Implementation . 147 General Notes on Table D 1 . 149 libm.a Notes . 150 E. References . 151 Chapter 2: “IEEE Arithmetic” . 152 Chapter 3: “The Math Libraries” . 153 Chapter 4: “Exceptions and Signal Handling”. 153 Chapter 5: “Compile-Debug-Run” . 154 Appendix B: “SPARC Behavior and Implementation” . 154 Manufacturer’s Documentation. 154 Standards . ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    200 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us