Draft International Iso/Iec Standard Wd 10967-1
Total Page:16
File Type:pdf, Size:1020Kb
SC22/WG11 N507 DRAFT INTERNATIONAL ISO/IEC STANDARD WD 10967-1 Working draft for the Second edition 2007-07-17 Information technology | Language independent arithmetic | Part 1: Integer and floating point arithmetic Technologies de l'information | Arithm´etiqueind´ependante des languages | Partie 1: Arithm´etiquedes nombres entiers et en virgule flottante Warning This document is not an ISO/IEC International Standard. It is distributed for review and comment. It is subject to change without notice and shall not be referred to as an International Standard. Recipients of this draft are invited to submit, with their comment, notification of any relevant patent rights of which they are aware and to provide supporting documentation. EDITOR'S WORKING DRAFT July 18, 2007 11:07 Editor: Kent Karlsson E-mail: [email protected] Reference number ISO/IEC WD 10967-1.1:2007(E) ISO/IEC WD 10967-1.1:2007(E) Working draft Copyright notice This ISO document is a Working Draft for an International Standard and is not copyright- protected by ISO. ii Working draft ISO/IEC WD 10967-1.1:2007(E) Contents Foreword vii Introduction viii 1 Scope 1 1.1 Inclusions . 1 1.2 Exclusions . 2 2 Conformity 3 3 Normative references 4 4 Symbols and definitions 4 4.1 Symbols . 4 4.1.1 Sets and intervals . 4 4.1.2 Operators and relations . 4 4.1.3 Exceptional values . 5 4.1.4 Datatypes . 6 4.1.5 Special values . 6 4.1.6 Operation specification framework . 6 4.2 Definitions of terms . 7 5 Specifications for integer and floating point datatypes and operations 10 5.1 Integer datatypes and operations . 12 5.1.1 Integer result function . 13 5.1.2 Integer operations . 13 5.1.2.1 Comparisons . 13 5.1.2.2 Basic arithmetic . 14 5.2 Floating point datatypes and operations . 15 5.2.1 Conformity to IEC 60559 . 17 5.2.2 Range and granularity constants . 17 5.2.3 Approximate operations . 17 5.2.4 Rounding and rounding constants . 18 5.2.5 Floating point result function . 19 5.2.6 Floating point operations . 20 5.2.6.1 Comparisons . 20 5.2.6.2 Basic arithmetic . 22 5.2.6.3 Value dissection . 24 5.2.6.4 Value splitting . 25 5.3 Operations for conversion between numeric datatypes . 26 5.4 Numerals as operations in a programming language . 26 6 Notification 26 6.1 Model handling of notifications . 26 6.2 Notification alternatives . 27 6.2.1 Recording in indicators . 27 6.2.2 Alteration of control flow . 29 iii ISO/IEC WD 10967-1.1:2007(E) Working draft 6.2.3 Termination with message . 29 6.3 Delays in notification . 29 6.4 User selection of alternative for notification . 30 7 Relationship with language standards 30 8 Documentation requirements 31 Annex A (normative) Partial conformity 33 A.1 Integer overflow notification relaxation . 33 A.2 Infinitary notification relaxation . 34 A.3 Denormalisation loss notification relaxations . 34 A.4 Subnormal values relaxation . 35 A.5 Accuracy relaxation for add, subtract, multiply, and divide . 35 A.6 Comparison operations relaxation . 38 A.7 Sign symmetric value set relaxation . 38 Annex B (informative) IEC 60559 bindings 39 B.1 Summary . 39 B.2 Notification . 40 B.3 Rounding . 41 Annex C (informative) Requirements beyond IEC 60559 43 Annex D (informative) Rationale 45 D.1 Scope . 45 D.1.1 Inclusions . 45 D.1.2 Exclusions . 45 D.1.3 Companion parts to this part . 46 D.2 Conformity . 46 D.2.1 Validation . 47 D.3 Normative references . 47 D.4 Symbols and definitions . 47 D.4.1 Symbols . 48 D.4.2 Definitions of terms . 48 D.5 Specifications for integer and floating point datatypes and operations . 49 D.5.1 Integer datatypes and operations . 50 D.5.1.0.1 Unbounded integers . 50 D.5.1.0.2 Bounded non-modulo integers . 51 D.5.1.0.3 Modulo integers . 51 D.5.1.0.4 Modulo integers versus overflow . 52 D.5.1.1 Integer result function . 52 D.5.1.2 Integer operations . 52 D.5.1.2.1 Comparisons . 52 D.5.1.2.2 Basic arithmetic . 52 D.5.2 Floating point datatypes and operations . 53 D.5.2.0.1 Constraints on the floating point parameters . 54 D.5.2.0.2 Radix complement floating point . 55 D.5.2.1 Conformity to IEC 60559 . 56 iv Working draft ISO/IEC WD 10967-1.1:2007(E) D.5.2.1.1 Subnormal numbers . 56 D.5.2.1.2 Signed zero . 57 D.5.2.1.3 Infinities and NaNs . 57 D.5.2.2 Range and granularity constants . 57 D.5.2.2.1 Relations among floating point datatypes . 58 D.5.2.3 Approximate operations . 58 D.5.2.4 Rounding and rounding constants . 59 D.5.2.5 Floating point result function . 60 D.5.2.6 Floating point operations . 60 D.5.2.6.1 Comparisons . 61 D.5.2.6.2 Basic arithmetic . 61 D.5.2.6.3 Value dissection . 61 D.5.2.6.4 Value splitting . 62 D.5.2.7 Levels of predictability . 62 D.5.2.8 Identities . 63 D.5.2.9 Precision, accuracy, and error . 65 D.5.2.9.1 LIA-1 and error . 66 D.5.2.9.2 Empirical and modelling errors . 66 D.5.2.9.3 Propagation of errors . 67 D.5.2.10 Extra precision . 68 D.5.3 Conversion operations . 68 D.6 Notification . 69 D.6.1 Model handling of notifications . 69 D.6.2 Notification alternatives . 69 D.6.2.1 Recording of indicators . 69 D.6.2.2 Alteration of control flow . 70 D.6.2.3 Termination with message . 71 D.6.3 Delays in notification . 71 D.6.4 User selection of alternative for notification . 71 D.7 Relationship with language standards . 72 D.8 Documentation requirements . 73 Annex E (informative) Example bindings for specific languages 75 E.1 Ada . 76 E.2 C.............................................. 80 E.3 C++ . 86 E.4 Fortran . 91 E.5 Common Lisp . ..