ISO/IEC 10967-2:2001
(Main)Information technology — Language independent arithmetic — Part 2: Elementary numerical functions
Information technology — Language independent arithmetic — Part 2: Elementary numerical functions
This part of ISO/IEC 10967 de_nes the properties of numerical approximations for many of the real elementary numerical functions available in standard libraries for a variety of programming languages in common use for mathematical and numerical applications. An implementor may choose any combination of hardware and software support to meet the speci_cations of this part. It is the computing environment, as seen by the programmer/user, that does or does not conform to the speci_cations. The term implementation (of this part) denotes the total computing environment pertinent to this part, including hardware, language processors, subroutine libraries, exception handling facilities, other software, and documentation.
Technologies de l'information — Arithmétique de langage indépendant — Partie 2: Fonctions numériques élémentaires
General Information
- Status
- Published
- Publication Date
- 15-Aug-2001
- Current Stage
- 9093 - International Standard confirmed
- Start Date
- 05-Sep-2023
- Completion Date
- 14-Feb-2026
Overview
ISO/IEC 10967-2:2001 - "Information technology - Language independent arithmetic - Part 2: Elementary numerical functions" defines the expected properties and behavior of elementary numerical functions provided by standard libraries across programming languages. The standard describes how an implementation (the complete computing environment: hardware, language processors, libraries, exception handling and documentation) should present integer and floating‑point arithmetic, transcendental functions, and datatype conversions so programmers get predictable, portable numeric results.
Key Topics and Requirements
- Scope and conformity: Specifies which mathematical operations and behaviors are included/excluded and what it means for a computing environment to conform.
- Integer and floating‑point operations: Formalizes basic integer ops, floating‑point max/min, rounding helpers, floor/ceil/round, remainder, square root and higher‑precision multiplication.
- Elementary transcendental functions: Requirements for exponentials, logarithms, trigonometric and hyperbolic functions (including radian and arbitrary angular units), hypotenuse, and related helpers.
- Accuracy and stability: Includes maximum error requirements, monotonicity and sign expectations for numerical approximations - guiding implementors on acceptable approximation quality.
- Conversions and numerals: Rules for conversion between integer, floating point and fixed point; handling of numerals in source languages.
- Notification and documentation: Guidance on exception/continuation values and required documentation for conformant implementations.
- Language bindings and examples: Informative annexes provide example bindings for many languages (Ada, C, C++, Fortran, Java, Haskell, Lisp, Pascal, etc.), helping map the abstract requirements to concrete APIs.
Applications and Who Uses It
- Implementors of math libraries and standard libraries for compilers and runtimes who need consistent definitions for elementary numerical functions.
- Compiler and language designers who must specify numeric behavior and conversions for language standards.
- Developers of scientific, engineering and financial software who require portable, predictable numeric results across platforms.
- Teams building embedded systems and high‑assurance systems where documented numeric behavior and error bounds are critical.
- Test and validation engineers creating conformance test suites for numeric operations.
Related Standards
- Part 1 (general language independent arithmetic concepts) and other ISO/IEC JTC 1 standards on numerical behavior - see the standard’s references and annexes for relationships with language standards and proposed Part 1 changes.
ISO/IEC 10967-2:2001 is a practical reference for anyone needing a language‑agnostic specification of elementary numeric functions, accuracy expectations, and cross‑platform conformance for numerical computing.
Get Certified
Connect with accredited certification bodies for this standard

BSI Group
BSI (British Standards Institution) is the business standards company that helps organizations make excellence a habit.

NYCE
Mexican standards and certification body.
Sponsored listings
Frequently Asked Questions
ISO/IEC 10967-2:2001 is a standard published by the International Organization for Standardization (ISO). Its full title is "Information technology — Language independent arithmetic — Part 2: Elementary numerical functions". This standard covers: This part of ISO/IEC 10967 de_nes the properties of numerical approximations for many of the real elementary numerical functions available in standard libraries for a variety of programming languages in common use for mathematical and numerical applications. An implementor may choose any combination of hardware and software support to meet the speci_cations of this part. It is the computing environment, as seen by the programmer/user, that does or does not conform to the speci_cations. The term implementation (of this part) denotes the total computing environment pertinent to this part, including hardware, language processors, subroutine libraries, exception handling facilities, other software, and documentation.
This part of ISO/IEC 10967 de_nes the properties of numerical approximations for many of the real elementary numerical functions available in standard libraries for a variety of programming languages in common use for mathematical and numerical applications. An implementor may choose any combination of hardware and software support to meet the speci_cations of this part. It is the computing environment, as seen by the programmer/user, that does or does not conform to the speci_cations. The term implementation (of this part) denotes the total computing environment pertinent to this part, including hardware, language processors, subroutine libraries, exception handling facilities, other software, and documentation.
ISO/IEC 10967-2:2001 is classified under the following ICS (International Classification for Standards) categories: 35.060 - Languages used in information technology. The ICS classification helps identify the subject area and facilitates finding related standards.
ISO/IEC 10967-2:2001 is available in PDF format for immediate download after purchase. The document can be added to your cart and obtained through the secure checkout process. Digital delivery ensures instant access to the complete standard document.
Standards Content (Sample)
INTERNATIONAL ISO/IEC
STANDARD 10967-2
First edition
2001-08-15
Information technology — Language
independent arithmetic —
Part 2:
Elementary numerical functions
Technologies de l'information — Arithmétique de langage indépendant —
Partie 2: Fonctions numériques élémentaires
Reference number
©
ISO/IEC 2001
PDF disclaimer
This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but shall not
be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this
file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat accepts no liability in this
area.
Adobe is a trademark of Adobe Systems Incorporated.
Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameters
were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event
that a problem relating to it is found, please inform the Central Secretariat at the address given below.
© ISO/IEC 2001
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic
or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or ISO's member body
in the country of the requester.
ISO copyright office
Case postale 56 � CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 749 09 47
E-mail copyright@iso.ch
Web www.iso.ch
Printed in Switzerland
ii © ISO/IEC 2001 – All rights reserved
c
ISO/IEC 2001 { All rights reserved ISO/IEC 10967-2:2001(E)
Contents
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
1 Scope 1
1.1 Inclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Exclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Conformity 2
3 Normative references 3
4 Symbols and denitions 4
4.1 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.1.1 Sets and intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.1.2 Operators and relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.1.3 Mathematical functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.1.4 Exceptional values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.1.5 Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.2 Denitions of terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5 Specications for integer 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 . . . . . . . . . . . . . . . . . . . . . . . . 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 tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . . 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.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 reciprocal 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 . . . . . . . . . . . . . . . . . 22
5.3.1 Maximum error requirements . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.3.2 Sign requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.3.3 Monotonicity requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.3.4 The result helper function . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.3.5 Hypotenuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.3.6 Operations for exponentiations and logarithms . . . . . . . . . . . . . . . . 24
iii
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 Exponentiation 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 . . . . . 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 Operations 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . . . . . . . . . . . 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 Argument 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 . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . . . . 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-unit 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 . . . . . . . . . . . . . . . . . . . . 53
5.3.10.1 Converting radian angle to argument angular-unit angle . . . . . . 53
iv
c
ISO/IEC 2001 { All rights reserved ISO/IEC 10967-2:2001(E)
5.3.10.2 Converting argument angular-unit angle to radian angle . . . . . . 54
5.3.10.3 Converting argument angular-unit angle to (another) 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.3.11.3 Hyperbolic tangent . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.3.11.4 Hyperbolic cotangent . . . . . . . . . . . . . . . . . . . . . . . . . 58
5.3.11.5 Hyperbolic secant . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
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 . . . . . . . . . . . . . . . . . . . . . . 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 Operations 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 conversions . . . . . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . . . . . 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 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 Part 1 requirements relaxation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Annex B (informative) Rationale 77
B.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
B.1.1 Inclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
B.1.2 Exclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
B.2 Conformity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
B.2.1 Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
B.3 Normative references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
B.4 Symbols and denitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
v
c
ISO/IEC 2001 { All rights reserved
B.4.1 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
B.4.1.1 Sets and intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
B.4.1.2 Operators and relations . . . . . . . . . . . . . . . . . . . . . . . . 80
B.4.1.3 Mathematical functions . . . . . . . . . . . . . . . . . . . . . . . . 80
B.4.1.4 Exceptional values . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
B.4.1.5 Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
B.4.2 Denitions of terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
B.5 Specications for 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 . . . . . . . . . . . . . . . . . . . . . . . . . . 83
B.5.1.6 Divisibility tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
B.5.1.7 Integer division (with
oor, round, or ceiling) and remainder . . . 83
B.5.1.8 Greatest common divisor and least common positive multiple . . . 84
B.5.1.9 Support operations for extended integer range . . . . . . . . . . . 84
B.5.2 Basic
oating point operations . . . . . . . . . . . . . . . . . . . . . . . . . 84
B.5.2.1 The rounding and
oating point result helper functions . . . . . . 86
B.5.2.2 Floating point maximum and minimum . . . . . . . . . . . . . . . 86
B.5.2.3 Floating point diminish . . . . . . . . . . . . . . . . . . . . . . . . 86
B.5.2.4 Floor, round, and ceiling . . . . . . . . . . . . . . . . . . . . . . . 86
B.5.2.5 Remainder after division and round to integer . . . . . . . . . . . 87
B.5.2.6 Square root and reciprocal square root . . . . . . . . . . . . . . . 87
B.5.2.7 Multiplication to higher precision
oating point datatype . . . . . 88
B.5.2.8 Support operations for extended
oating point precision . . . . . . 88
B.5.3 Elementary transcendental
oating point operations . . . . . . . . . . . . . 89
B.5.3.1 Maximum error requirements . . . . . . . . . . . . . . . . . . . . . 89
B.5.3.2 Sign requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
B.5.3.3 Monotonicity requirements . . . . . . . . . . . . . . . . . . . . . . 90
B.5.3.4 The result helper function . . . . . . . . . . . . . . . . . . . . . . 90
B.5.3.5 Hypotenuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
B.5.3.6 Operations for exponentiations and logarithms . . . . . . . . . . . 91
B.5.3.7 Introduction to operations for trigonometric elementary functions 93
B.5.3.8 Operations for radian trigonometric elementary functions . . . . . 94
B.5.3.9 Operations for trigonometrics with given angular unit . . . . . . . 96
B.5.3.10 Operations for angular-unit conversions . . . . . . . . . . . . . . . 97
B.5.3.11 Operations for hyperbolic elementary functions . . . . . . . . . . . 98
B.5.4 Operations for conversion between numeric datatypes . . . . . . . . . . . . 98
B.5.5 Numerals as operations in a programming language . . . . . . . . . . . . . 99
B.5.5.1 Numerals for integer datatypes . . . . . . . . . . . . . . . . . . . . 99
B.5.5.2 Numerals for
oating point datatypes . . . . . . . . . . . . . . . . 99
B.6 Notication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
B.6.1 Continuation values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
B.7 Relationship with language standards . . . . . . . . . . . . . . . . . . . . . . . . . 101
B.8 Documentation requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
vi
c
ISO/IEC 2001 { All rights reserved ISO/IEC 10967-2:2001(E)
Annex C (informative) Example bindings for specic languages 103
C.1 Ada . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
C.2 BASIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
C.3 C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
C.4 C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
C.5 Fortran . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
C.6 Haskell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
C.7 Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
C.8 Common Lisp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
C.9 ISLisp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
C.10 Modula-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
C.11 Pascal and Extended Pascal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
C.12 PL/I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
C.13 SML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Annex D (informative) Bibliography 173
Annex E (informative) Possible changes to part 1 177
vii
c
ISO/IEC 2001 { All rights reserved
Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotech-
nical Commission) form the specialized system for worldwide standardization. National bodies
that are members of ISO or IEC participate in the development of International Standards through
technical committees established by the respective organization to deal with particular elds of
technical activity. ISO and IEC technical committees collaborate in elds of mutual interest.
Other international organizations, governmental and non-governmental, in liaison with ISO and
IEC, also take part in the work.
International Standards are drafted in accordance with the rules given in the ISO/IEC Direc-
tives, Part 3.
In the eld of information technology, ISO and IEC have established a joint technical committee,
ISO/IEC JTC 1. Draft International Standards adopted by the joint technical committee are
circulated to national bodies for voting. Publication as an International Standard requires approval
by at least 75 % of the national bodies casting a vote.
Attention is drawn to the possibility that some of the elements of this part of ISO/IEC 10967
may be the subject of patent rights. ISO and IEC shall not be held responsible for identifying
any or all such patent rights.
International Standard ISO/IEC 10967-2 was prepared by Joint Technical Committee ISO/IEC
JTC 1, Information technology, Subcommittee SC 22, Programming languages, their environments
and system software interfaces.
ISO/IEC 10967 consists of the following parts, under the general title Information technology
| Language independent arithmetic:
{ Part 1: Integer and
oating point arithmetic
{ Part 2: Elementary numerical functions
{ Part 3: Complex integer and
oating point arithmetic and complex elementary numerical
functions
Additional parts will specify other arithmetic datatypes or arithmetic operations.
Annex A forms a normative part of this part of ISO/IEC 10967. Annexes B to E are for
information only.
viii
c
ISO/IEC 2001 { All rights reserved ISO/IEC 10967-2:2001(E)
Introduction
The aims
Portability is a key issue for scientic and numerical software in today's heterogeneous computing
environment. Such software may be required to run on systems ranging from personal computers
to high performance pipelined vector processors and massively parallel systems, and the source
code may be ported between several programming languages. Part 1 of ISO/IEC 10967 species
the basic properties of integer and
oating point types that can be relied upon in writing portable
software.
Programmers writing programs that perform a signicant amount of numeric processing have
often not been certain how a program will perform when run under a given language processor.
Programming language standards have traditionally been somewhat weak in the area of numeric
processing, seldom providing an adequate specication of the properties of arithmetic datatypes,
particularly
oating point numbers. Often they do not even require much in the way of documen-
tation of the actual arithmetic operations by a conforming language processor.
It is the intent of this part to help to redress these shortcomings, by setting out precise deni-
tions of elementary numerical functions, and requirements for documentation.
It is not claimed that this part will ensure complete certainty of arithmetic behaviour in all
circumstances; the complexity of numeric software and the diculties of analysing and proving
algorithms are too great for that to be attempted. Rather, this International Standard will provide
a rmer basis than hitherto for attempting such analysis.
The aims for this part, part 2 of ISO/IEC 10967, are extensions of the aims for part 1: to ensure
adequate accuracy for numerical computation, predictability, notication on the production of
exceptional results, and compatibility with programming language standards.
The content
The content of this part is based on part 1, and extends part 1's specications to specications for
operations approximating real elementary functions, operations often required (usually without
a detailed specication) by the standards for programming languages widely used for scientic
software. This part also provides specications for conversions between the \internal" values of
an arithmetic datatype, and a very close approximation in, e.g., the decimal radix. It does not
cover the further transformation to decimal string format, which is usually provided by language
standards. This part also includes specications for a number of other functions deemed useful,
even though they may not be stipulated by programming language standards.
The numerical functions covered by this part are computer approximations to mathematical
functions of one or more real arguments. Accuracy versus performance requirements often vary
with the application at hand. This is recognised by recommending that implementors support more
than one library of these numerical functions. Various documentation and (program available)
parameters requirements are specied to assist programmers in the selection of the library best
suited to the application at hand.
The benets
Adoption and proper use of this part can lead to the following benets.
Language standards will be able to dene their arithmetic semantics more precisely without
preventing the ecient implementation of their language on a wide range of machine architectures.
ix
c
ISO/IEC 2001 { All rights reserved
Programmers of numeric software will be able to assess the portability of their programs in
advance. Programmers will be able to trade o program design requirements for portability in
the resulting program.
Programs will be able to determine (at run time) the crucial numeric properties of the imple-
mentation. They will be able to reject unsuitable implementations, and (possibly) to correctly
characterize the accuracy of their own results. Programs will be able to detect (and possibly
correct for) exceptions in arithmetic processing.
End users will nd it easier to determine whether a (properly documented) application program
is likely to execute satisfactorily on their platform. This can be done by comparing the documented
requirements of the program against the documented properties of the platform.
Finally, end users of numeric application packages will be able to rely on the correct execution
of those packages. That is, for correctly programmed algorithms, the results are reliable if and
only if there is no notication.
x
c
ISO/IEC 2001
INTERNATIONAL STANDARD ISO/IEC 10967-2:2001(E)
Information technology |
Language independent arithmetic |
Part 2: Elementary numerical functions
1 Scope
This part of ISO/IEC 10967 denes the properties of numerical approximations for many of the
real elementary numerical functions available in standard libraries for a variety of programming
languages in common use for mathematical and numerical applications.
An implementor may choose any combination of hardware and software support to meet the
specications of this part. It is the computing environment, as seen by the programmer/user, that
does or does not conform to the specications.
The term implementation (of this part) denotes the total computing environment pertinent
to this part, including hardware, language processors, subroutine libraries, exception handling
facilities, other software, and documentation.
1.1 Inclusions
The specications of part 1 are included by reference in this part.
This part provides specications for numerical functions for which all operand values are of
integer or
oating point datatypes satisfying the requirements of part 1. Boundaries for the oc-
currence of exceptions and the maximum error allowed are prescribed for each specied operation.
Also the result produced by giving a special value operand, such as an innity, or a NaN, is
prescribed for each specied
oating point operation.
This part covers most numerical functions required by the ISO/IEC standards for Ada [11],
Basic [16], C [17], C++ [18], Fortran [22], ISLisp [24], Pascal [27], and PL/I [29]. In particular,
specications are provided for:
a) Some additional integer operations.
b) Some additional non-transcendental
oating point operations, including maximum and min-
imum operations.
c) Exponentiations, logarithms, and hyperbolics.
d) Trigonometrics, both in radians and for argument-given angular unit with degrees as a
special case.
This part also provides specications for:
1. Scope 1
c
ISO/IEC 2001 { All rights reserved
e) Conversions between integer and
oating point datatypes (possibly with dierent radices)
conforming to the requirements of part 1, and the conversion operations used, for example,
in text input and output of integer and
oating point numbers.
f) The results produced by an included
oating point operation when one or more argument
values are IEC 60559 special values.
g) Program-visible parameters that characterise certain aspects of the operations.
1.2 Exclusions
This part provides no specications for
a) Numerical functions whose operands are of more than one datatype (with one exception).
This part neither requires nor excludes the presence of such \mixed operand" operations.
b) An interval datatype, or the operations on such data. This part neither requires nor excludes
such data or operations.
c) A xed point datatype, or the operations on such data. This part neither requires nor
excludes such data or operations.
d) A rational datatype, or the operations on such data. This part neither requires nor excludes
such data or operations.
e) Complex, matrix, statistical, or symbolic operations. This part neither requires nor excludes
such data or operations.
f) The properties of arithmetic datatypes that are not related to the numerical process, such
as the representation of values on physical media.
g) The properties of integer and
oating point datatypes that properly belong in programming
language standards or other specications. Examples include
1) the syntax of numerals and expressions in the programming language,
2) the syntax used for parsed (input) or generated (output) character string forms for
numerals by any specic programming language or library,
3) the precedence of operators in the programming language,
4) the presence or absence of automatic datatype coercions,
5) the rules for assignment, parameter passing, and returning value,
6) the consequences of applying an operation to values of improper datatype, or to unini-
tialised data.
Furthermore, this part does not provide specications for how the operations should be imple-
mented or which algorithms are to be used for the various operations.
2 Conformity
It is expected that the provisions of this part of ISO/IEC 10967 will be incorporated by refer-
ence and further dened in other International Standards; specically in programming language
standards and in binding standards.
2 Conformity
c
ISO/IEC 2001 { All rights reserved ISO/IEC 10967-2:2001(E)
A binding standard species the correspondence between one or more of the parameters and
operations specied in this part and the concrete language syntax of some programming language.
More generally, a binding standard species the correspondence between certain parameters and
operations and the elements of some arbitrary computing entity. A language standard that ex-
plicitly provides such binding information can serve as a binding standard.
When a binding standard for a language exists, an implementation shall be said to conform to
this part if and only if it conforms to the binding standard. In case of con
ict between a binding
standard and this part, the specication of the binding standard takes precedence.
When a binding standard covers only a subset of the operations specied in this part, an im-
plementation remains free to conform to this part with respect to other operations, independently
of that binding standard.
When no binding standard for a language and some operations specied in this part exists,
an implementation conforms to this part if and only if it provides one or more operations that
together satisfy all the requirements of clauses 5 through 8 that are relevant to those operations.
The implementation shall then document the binding.
Conformity to this part is always with respect to a specied set of datatypes and operations.
Conformity to this part implies conformity to part 1 for the integer and
oating point datatypes
used.
An implementation is free to provide operations that do not conform to this part, or that are
beyond the scope of this part. The implementation shall not claim or imply conformity to this
part with respect to such operations.
An implementation is permitted to have modes of operation that do not conform to this part.
A conforming implementation shall specify how to select the modes of operation that ensure
conformity. However, a mode of operation that conforms to this part should be the default mode
of operation.
NOTES
1 Language bindings are essential. Clause 8 requires an implementation to supply a binding
if no binding standard exists. See annex C for suggested language bindings.
2 A complete binding for this part will include (explicitly or by reference) a binding for part 1
as well, which in turn may include (explicitly or by reference) a binding for IEC 60559 as
well.
3 This part does not require a particular set of operations to be provided. It is not possible
to conform to this part without specifying to which datatypes and set of operations (and
modes of operation) conformity is claimed.
3 Normative references
The following normative documents contain provisions which, through reference in this text,
constitute provisions of this part of ISO/IEC 10967. For dated references, subsequent amendments
to, or revisions of, any of these publications do not apply. However, parties to agreements based
on this part of ISO/IEC 10967 are encouraged to investigate the possibility of applying the most
recent editions of the normative documents indicated below. For undated references, the latest
edition of the normative document referred to applies. Members of ISO and IEC maintain registers
of currently valid International Standards.
3. Normative references 3
c
ISO/IEC 2001 { All rights reserved
IEC 60559:1989, Binary
oating-point arithmetic for microprocessor systems.
ISO/IEC 10967-1:1994, Information technology { Language independent arithmetic {
Part 1: Integer and
oating point arithmetic.
NOTE { See also annex E.
4 Symbols and denitions
4.1 Symbols
4.1.1 Sets and intervals
In this part,Z denotes the set of mathematical integers,R denotes the set of classical real numbers,
andC denotes the set of complex numbers overR. Note thatZRC.
The conventional notation for set denition and manipulation is used.
In this part, the following notation for intervals is used
[x;z] designates the intervalfy2Rj x6y6zg,
]x;z] designates the intervalfy2Rj x
[x;z[ designates the intervalfy2Rj x6y
]x;z[ designates the intervalfy2Rj x
NOTE { The notation using a round bracket for an open end of an interval is not used, for
the risk of confusion with the notation for pairs.
4.1.2 Operators and relations
All prex and inx operators have their conventional (exact) mathematical meaning. In particular
this part uses
) and, for logical implication and equivalence
+,, =,jxj,bxc,dxe, and round(x) on reals
for multiplication on reals
<,6,>, and > between reals
= and6= between real as well as special values
max on non-empty upwardly closed sets of reals
min on non-empty downwardly closed sets of reals
[,\,,2,62,,,*,6=, and = with sets
for the Cartesian product of sets
! for a mapping between sets
j for the divides relation between integers
For x2R, the notationbxc designates the largest integer not greater than x:
bxc2Z and x 1
the notationdxe designates the smallest integer not less than x:
dxe2Z and x6dxe
4 Symbols and denitions
c
ISO/IEC 2001 { All rights reserved ISO/IEC 10967-2:2001(E)
and the notation round(x) designates the integer closest to x:
round(x)2Z and x 0:56 round(x)6x + 0:5
where in case x is exactly half-way between two integers, the even integer is the result.
The divides relation (j) on integers tests whether an integer i divides an integer j exactly:
ijj , (i6= 0 and in =j for some n2Z)
NOTE { ijj is true exactly when j=i is dened and j=i2Z).
4.1.3 Mathematical functions
This part species properties for a number of operations numerically approximating some of the
elementary functions. The following ideal mathematical functions are dened in chapter 4 of the
Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables [47] (e is
the Napierian base)
p
x y
e , x , x, ln, log ,
b
sin, cos, tan, cot, sec, csc, arcsin, arccos, arctan, arccot, arcsec, arccsc,
sinh, cosh, tanh, coth, sech, csch, arcsinh, arccosh, arctanh, arccoth, arcsech, arccsch.
Many of the inverses above are multi-valued. The selection of which value to return, the
principal value, so as to make the inverses into functions, is done in the conventional way. E.g.,
p
x2 [0;1[ when x2 [0;1[. The only one over which there is some dierence of conventions
is the arccot function. Conventions there vary for negative arguments; either a negative value
(giving a sign symmetric function), or a positive return value (giving a function that is continuous
over zero). In this part, arccot refers to the sign symmetric inverse function (with a branch cut
at 0), and arccotc refers to the continuous inverse function.
arccosh(x)> 0, arcsech(x)> 0,
arcsin(x)2 [=2;=2], arccos(x)2 [0;], arctan(x)2 ]=2;=2[,
arccot(x)2 ]=2;=2], arccotc(x)2 ]0;[, arcsec(x)2 [0;], arccsc(x)2 [=2;=2].
NOTE { e = 2:71828:::. e is not in any
oating point datatype conforming to part 1, unless
added as a special value, which is usually not done.
4.1.4 Exceptional values
The exceptional value under
ow is used in this part as it is in part 1.
Three new exceptional values, over
ow, invalid, and innitary, are introduced in this part
replacing three other exceptional values used in part 1. invalid and innitary are in this part
used instead of the undened of part 1. over
ow is used instead of the integer over
ow
and
oating over
ow of part 1. Bindings may still distinguish between integer over
ow and
oating over
ow.
One new exceptional value, absolute precision under
ow, is introduced in this part with
no correspondence in part 1. The exceptional value absolute precision under
ow is used when
the given
oating point angle value argument is so big that even a highly accurate result from a
trigonometric operation is questionable, due to the fact that the density of
oating point values
has decreased signicantly at these big angle values.
4.1.3 Mathematical functions 5
c
ISO/IEC 2001 { All rights reserved
For the exceptional values, a continuation value may be given in parenthesis after the excep-
tional value.
4.1.5 Datatypes
The datatype Boolean consists of the two values true and false.
NOTE 1 { Mathematical relations are true or false (or undened, if an operand is undened).
In contrast, true and false are values in Boolean.
For pairs, dene:
fst((x;y)) =x
snd((x;y)) =y
Square brackets are used to write nite sequences of values. [] is the sequence containing no
values. [s], is the sequence of one value, s. [s ;s ], is the sequence of two values, s and then s ,
1 2 1 2
etc. The colon operator is used to prepend a value to a sequence: x : [x ;:::;x ] = [x;x ;:::;x ].
1 n 1 n
[S], where S is a set, denotes the set of nite sequences, where each value in a sequence is in S.
NOTE 2 { It is always clear from context, in the text of this part, if [X] is a sequence of one
element, or the set of sequences with values from X. It is also clear from context if [x ;x ] is
1 2
a sequence of two values or an interval.
Integer datatypes and
oating point datatypes are dened in part 1. Let I be the non-special
value set for an integer datatype conforming to part 1. Let F be the non-special value set for a
oating point datatype conforming to part 1. Floating point datatypes that conform to part 1
shall, for use with this part, have a value for the parameter p such that p > 2maxf1;dlog (2
F F
r
F
)eg, and have a value for the parameter emin such that emin 6p 1.
F F F
NOTES
3 This implies that fminN < 0:5epsilon =r in this part, rather than just fminN 6
F F F F
epsilon .
F
4 These extra requirements, which do not limit the use of any existing
oating point datatype,
are made 1) so that angles in radians are not too degenerate within the rst two cycles,
plus and minus, when represented in F, and 2) in order to be able to avoid the under
ow
notication in specications for the expm1 and ln1p operations.
F F
5 F should also be such that p > 2 +dlog (1000)e, to allow for a not too coarse angle
F
r
F
resolution anywhere in the interval [big angle r ;big angle r ]. See clause 5.3.8.
F F
The following symbols represent special values dened in IEC 60559 and used in this part:
+1 1
0, ++11,11, qNaN, and sNaN.
These values are not part of the setI or the setF, but if iec 559 has the value true, these values
F
are included in the
oating point datatype corresponding to F.
NOTE 6 { This part uses the above ve special values for compatibility with IEC 60559. In
particular, the symbol0 (in bold) is not the application of (mathematical) unary to the
value 0, and is a value logically distinct from 0.
The specications cover the results to be returned by an operation if given one or more of the
IEC 60559 special values0, +++111,111, or NaNs as input values. These specications apply only
to systems which provide and support these special values. If an implementation is not capable
of representing a0 result or continuation value, the actual result or continuation value shall be
0. If an implementation is not capable of representing a prescribed result or continuation value
6 Symbols and denitions
c
ISO/IEC 2001 { All rights reserved ISO/IEC 10967-2:2001(E)
of the IEC 60559 special values +++111,111, or qNaN, the actual result or continuation value is
binding or implementation dened.
The following symbols used in this part are dened in part 1:
Integer parameters:
bounded , maxint , and minint .
I I I
Integer helper function:
wrap .
I
Integer operations:
neg , add , sub , and mul .
I I I I
Floating point parameters:
r , p , emin , emax , denorm , and iec 559 .
F F F F F F
Derived
oating point constants:
fmax , fmin , fminN , fminD , and epsilon .
F F
F F F
Floating point rounding constant:
rnd error .
F
Floating point value sets related to F :
F , F , and F .
D N
Floating point helper functions:
e , result , and rnd .
F F F
Floating point operations:
neg , add , sub , mul , div , and ulp .
F F F F F
F
4.2 Denitions of terms
For the purposes of this part, the following denitions apply:
accuracy: The closeness between the true mathematical result and a computed result.
arithmetic datatype: A datatype whose non-special values are members ofZ,R, orC.
NOTE 1 { This part species requirements for integer and
oating point datatypes.
Complex numbers are not covered by this part, but will be included in a subsequent part
of ISO/IEC 10967 [3].
continuation value: A computational value used as the result of an arithmetic operation when
an exception occurs. Continuation values are intended to be used in subsequent arithmetic
processing. A continuation value can be a (in the datatype representable) value inR or an
IEC 60559 special value. (Contrast with exceptional value. See clause 6.1 of part 1.)
denormalisation loss: A larger than normal rounding error caused by the fact that subnormal
values have less than full precision. (See clause 5.2 of part 1 for a full denition.)
error: (1) The dierence between a computed value and the correct value. (Used in phrases like
\rounding error" or \error bound".)
(2) A synonym for exception in phrases like \error message" or \error output". Error and
exception are not synonyms in any other context.
exception: The inability of an operation to return a suitable nite numeric result from nite
arguments. This might arise because no such nite result exists mathematically (innitary
4.2 Denitions of terms 7
c
ISO/IEC 2001 { All rights reserved
(e.g. at a pole), invalid (e.g. when the true result is inC but not inR), or because the math-
ematical result cannot, or might not, be representable with sucient accuracy (under
ow,
over
ow) or viability (absolute precision under
ow).
NOTE 2 { The term exception is here not used to designate certain methods of handling
notications that fall under the category `change of control
ow'. Such methods of noti-
cation handling will be referred to as \[programming language name] exception", when
referred to, particularly in annex C.
exceptional value: A non-numeric value produced by an arithmetic operation to indicate the
occurrence of an exception. Exceptional values are not used in subsequent arithmetic pro-
cessing. (See clause 5 of part 1.)
NOTES
3 Exceptional values are used as part of the dening formalism only. With respe
...




Questions, Comments and Discussion
Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.
Loading comments...