1、BRITISH STANDARD BS ISO/IEC 10967-2:2001 Information technology Language independent arithmetic Part 2: Elementary numerical functions ICS 35.060 NO COPYING WITHOUT BSI PERMISSION EXCEPT AS PERMITTED BY COPYRIGHT LAWBS ISO/IEC 10967-2:2001 This British Standard, having been prepared under the direct
2、ion of the DISC Board, was published under the authority of the Standards Policy and Strategy Committee on 24 August 2001 BSI 24 August 2001 ISBN 0 580 38060 2 National foreword This British Standard reproduces verbatim ISO/IEC 10967-2:2001 and implements it as the UK national standard. The UK parti
3、cipation in its preparation was entrusted to Technical Committee IST/5, Programming Languages, Their Environments and System Software Interfaces, which has the responsibility to: A list of organizations represented on this committee can be obtained on request to its secretary. Cross-references The B
4、ritish Standards which implement international or European publications referred to in this document may be found in the BSI Standards Catalogue under the section entitled “International Standards Correspondence Index”, or by using the “Find” facility of the BSI Standards Electronic Catalogue. A Bri
5、tish Standard does not purport to include all the necessary provisions of a contract. Users of British Standards are responsible for their correct application. Compliance with a British Standard does not of itself confer immunity from legal obligations. aid enquirers to understand the text; present
6、to the responsible international/European committee any enquiries on the interpretation, or proposals for change, and keep the UK interests informed; monitor related international and European developments and promulgate them in the UK. Summary of pages This document comprises a front cover, an insi
7、de front cover, the ISO/IEC title page, pages ii to x, pages 1 to 177 and a back cover The BSI copyright date displayed in this document indicates when the document was last issued. Amendments issued since publication Amd. No. Date CommentsReference number ISO/IEC 10967-2:2001(E) ISO/IEC 2001 INTERN
8、ATIONAL STANDARD ISO/IEC 10967-2 First edition 2001-08-15 Information technology Language independent arithmetic Part 2: Elementary numerical functions Technologies de linformation Arithmtique de langage indpendant Partie 2: Fonctions numriques lmentairesii ISO/IEC109672:2001(E) c CEI/OSI 1002 llA r
9、ights vreserde ISO/IEC 10967-2:2001(E) Contents Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix 1 Scope 1 1.1 Inclusions . . . . . . . . . . . .
10、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Exclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Conformity 2 3 Normative references 3 4 Symbols and denitions 4 4.1 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11、. . . . . . . . . . . 4 4.1.1 Sets and intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4.1.2 Operators and relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4.1.3 Mathematical functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.1.
12、4 Exceptional values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.1.5 Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4.2 Denitions of terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 5 Specications for integ
13、er and oating point operations 10 5.1 Basic integer operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 5.1.1 The integer result and wrap helper functions . . . . . . . . . . . . . . . . . 10 5.1.2 Integer maximum and minimum . . . . . . . . . . . . . . . . . . . . . . .
14、. 11 5.1.3 Integer diminish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 5.1.4 Integer power and arithmetic shift . . . . . . . . . . . . . . . . . . . . . . . 12 5.1.5 Integer square root . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 5.1.6 Divisibility t
15、ests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 5.1.7 Integer division (with oor, round, or ceiling) and remainder . . . . . . . . 13 5.1.8 Greatest common divisor and least common positive multiple . . . . . . . . 13 5.1.9 Support operations for extended integer range . .
16、. . . . . . . . . . . . . . . 14 5.2 Basic oating point operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 5.2.1 The rounding and oating point result helper functions . . . . . . . . . . . 15 5.2.2 Floating point maximum and minimum . . . . . . . . . . . . . . . . . . . . 17 5.2
17、.3 Floating point diminish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 5.2.4 Floor, round, and ceiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.2.5 Remainder after division with round to integer . . . . . . . . . . . . . . . . 20 5.2.6 Square root and reciproca
18、l square root . . . . . . . . . . . . . . . . . . . . . 20 5.2.7 Multiplication to higher precision oating point datatype . . . . . . . . . . 20 5.2.8 Support operations for extended oating point precision . . . . . . . . . . . 21 5.3 Elementary transcendental oating point operations . . . . . . . .
19、 . . . . . . . . . 22 5.3.1 Maximum error requirements . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.3.2 Sign requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.3.3 Monotonicity requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.3.4 The
20、result helper function . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.3.5 Hypotenuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 5.3.6 Operations for exponentiations and logarithms . . . . . . . . . . . . . . . . 24 iii ISO/IEC109672:2001(E) ICEI/OS )E(1002
21、:2-76901 c ISO/IEC 2001 All rights reserved 5.3.6.1 Integer power of argument base . . . . . . . . . . . . . . . . . . . 24 5.3.6.2 Natural exponentiation . . . . . . . . . . . . . . . . . . . . . . . . 25 5.3.6.3 Natural exponentiation, minus one . . . . . . . . . . . . . . . . . . 26 5.3.6.4 Expon
22、entiation of 2 . . . . . . . . . . . . . . . . . . . . . . . . . . 27 5.3.6.5 Exponentiation of 10 . . . . . . . . . . . . . . . . . . . . . . . . . 27 5.3.6.6 Exponentiation of argument base . . . . . . . . . . . . . . . . . . . 28 5.3.6.7 Exponentiation of one plus the argument base, minus one . .
23、 . . . 29 5.3.6.8 Natural logarithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5.3.6.9 Natural logarithm of one plus the argument . . . . . . . . . . . . . 30 5.3.6.10 2-logarithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.3.6.11 10-logarithm . . . . . . . . . .
24、 . . . . . . . . . . . . . . . . . . . . 31 5.3.6.12 Argument base logarithm . . . . . . . . . . . . . . . . . . . . . . . 31 5.3.6.13 Argument base logarithm of one plus each argument . . . . . . . . 32 5.3.7 Introduction to operations for trigonometric elementary functions . . . . . . 32 5.3.8 Ope
25、rations for radian trigonometric elementary functions . . . . . . . . . . 33 5.3.8.1 Radian angle normalisation . . . . . . . . . . . . . . . . . . . . . . 34 5.3.8.2 Radian sine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.3.8.3 Radian cosine . . . . . . . . . . . . . . . . .
26、. . . . . . . . . . . . 35 5.3.8.4 Radian tangent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.3.8.5 Radian cotangent . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.3.8.6 Radian secant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 5.3.8.7 Radian cosecant
27、. . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 5.3.8.8 Radian cosine with sine . . . . . . . . . . . . . . . . . . . . . . . . 38 5.3.8.9 Radian arc sine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 5.3.8.10 Radian arc cosine . . . . . . . . . . . . . . . . . . . . . . . .
28、. . . 38 5.3.8.11 Radian arc tangent . . . . . . . . . . . . . . . . . . . . . . . . . . 39 5.3.8.12 Radian arc cotangent . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.3.8.13 Radian arc secant . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.3.8.14 Radian arc cosecant . . . . . .
29、. . . . . . . . . . . . . . . . . . . . 41 5.3.8.15 Radian angle from Cartesian co-ordinates . . . . . . . . . . . . . . 42 5.3.9 Operations for trigonometrics with given angular unit . . . . . . . . . . . . 43 5.3.9.1 Argument angular-unit angle normalisation . . . . . . . . . . . . . 43 5.3.9.2 Ar
30、gument angular-unit sine . . . . . . . . . . . . . . . . . . . . . . 44 5.3.9.3 Argument angular-unit cosine . . . . . . . . . . . . . . . . . . . . 45 5.3.9.4 Argument angular-unit tangent . . . . . . . . . . . . . . . . . . . . 45 5.3.9.5 Argument angular-unit cotangent . . . . . . . . . . . . . .
31、 . . . . 46 5.3.9.6 Argument angular-unit secant . . . . . . . . . . . . . . . . . . . . 47 5.3.9.7 Argument angular-unit cosecant . . . . . . . . . . . . . . . . . . . 47 5.3.9.8 Argument angular-unit cosine with sine . . . . . . . . . . . . . . . 48 5.3.9.9 Argument angular-unit arc sine . . . . .
32、 . . . . . . . . . . . . . . 48 5.3.9.10 Argument angular-unit arc cosine . . . . . . . . . . . . . . . . . . 48 5.3.9.11 Argument angular-unit arc tangent . . . . . . . . . . . . . . . . . 49 5.3.9.12 Argument angular-unit arc cotangent . . . . . . . . . . . . . . . . 50 5.3.9.13 Argument angular-u
33、nit arc secant . . . . . . . . . . . . . . . . . . 51 5.3.9.14 Argument angular-unit arc cosecant . . . . . . . . . . . . . . . . . 51 5.3.9.15 Argument angular-unit angle from Cartesian co-ordinates . . . . . 52 5.3.10 Operations for angular-unit conversions . . . . . . . . . . . . . . . . . . . .
34、53 5.3.10.1 Converting radian angle to argument angular-unit angle . . . . . . 53 iv ISO/IEC109672:2001(E) c ISO/IEC 2001 All rights reserved CEI/OSI )E(1002:2-76901 5.3.10.2 Converting argument angular-unit angle to radian angle . . . . . . 54 5.3.10.3 Converting argument angular-unit angle to (ano
35、ther) argument angular-unit angle . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.3.11 Operations for hyperbolic elementary functions . . . . . . . . . . . . . . . . 56 5.3.11.1 Hyperbolic sine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 5.3.11.2 Hyperbolic cosine . . . .
36、 . . . . . . . . . . . . . . . . . . . . . . . 56 5.3.11.3 Hyperbolic tangent . . . . . . . . . . . . . . . . . . . . . . . . . . 57 5.3.11.4 Hyperbolic cotangent . . . . . . . . . . . . . . . . . . . . . . . . . 58 5.3.11.5 Hyperbolic secant . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
37、5.3.11.6 Hyperbolic cosecant . . . . . . . . . . . . . . . . . . . . . . . . . . 59 5.3.11.7 Inverse hyperbolic sine . . . . . . . . . . . . . . . . . . . . . . . . 59 5.3.11.8 Inverse hyperbolic cosine . . . . . . . . . . . . . . . . . . . . . . . 60 5.3.11.9 Inverse hyperbolic tangent . . . . . .
38、. . . . . . . . . . . . . . . . 60 5.3.11.10 Inverse hyperbolic cotangent . . . . . . . . . . . . . . . . . . . . . 60 5.3.11.11 Inverse hyperbolic secant . . . . . . . . . . . . . . . . . . . . . . . 61 5.3.11.12 Inverse hyperbolic cosecant . . . . . . . . . . . . . . . . . . . . . . 61 5.4 Operati
39、ons for conversion between numeric datatypes . . . . . . . . . . . . . . . . 62 5.4.1 Integer to integer conversions . . . . . . . . . . . . . . . . . . . . . . . . . . 63 5.4.2 Floating point to integer conversions . . . . . . . . . . . . . . . . . . . . . . 63 5.4.3 Integer to oating point convers
40、ions . . . . . . . . . . . . . . . . . . . . . . 64 5.4.4 Floating point to oating point conversions . . . . . . . . . . . . . . . . . . 64 5.4.5 Floating point to xed point conversions . . . . . . . . . . . . . . . . . . . . 65 5.4.6 Fixed point to oating point conversions . . . . . . . . . . . . .
41、 . . . . . . . 66 5.5 Numerals as operations in a programming language . . . . . . . . . . . . . . . . . . 67 5.5.1 Numerals for integer datatypes . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.5.2 Numerals for oating point datatypes . . . . . . . . . . . . . . . . . . . . . 68 6 Notication
42、68 6.1 Continuation values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 7 Relationship with language standards 69 8 Documentation requirements 70 Annex A (normative) Partial conformity 73 A.1 Maximum error relaxation . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43、 . . . . 73 A.2 Extra accuracy requirements relaxation . . . . . . . . . . . . . . . . . . . . . . . . 74 A.3 Relationships to other operations relaxation . . . . . . . . . . . . . . . . . . . . . . 74 A.4 Very-close-to-axis angular normalisation relaxation . . . . . . . . . . . . . . . . . . 74 A.5
44、 Part 1 requirements relaxation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Annex B (informative) Rationale 77 B.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 B.1.1 Inclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45、. . . . . . . . . 77 B.1.2 Exclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 B.2 Conformity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 B.2.1 Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
46、. . 79 B.3 Normative references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 B.4 Symbols and denitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 v ISO/IEC109672:2001(E) ICEI/OS )E(1002:2-76901 c ISO/IEC 2001 All rights reserved B.4.1 Symbols . .
47、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 B.4.1.1 Sets and intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 B.4.1.2 Operators and relations . . . . . . . . . . . . . . . . . . . . . . . . 80 B.4.1.3 Mathematical functions . . . . . . . . . . . . .
48、. . . . . . . . . . . 80 B.4.1.4 Exceptional values . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 B.4.1.5 Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 B.4.2 Denitions of terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 B.5 Specications f
49、or the numerical functions . . . . . . . . . . . . . . . . . . . . . . . 81 B.5.1 Basic integer operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 B.5.1.1 The integer result and wrap helper functions . . . . . . . . . . . . 82 B.5.1.2 Integer maximum and minimum . . . . . . . . . . . . . . . . . . . 82 B.5.1.3 Integer diminish . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 B.5.1.4 Integer power and arithmetic shift . . . . . . . . . . . . . . . . . . 83 B.5.1.5 Integer square root . .