ISO/IEC 10967-1:2012
(Main)Information technology — Language independent arithmetic — Part 1: Integer and floating point arithmetic
General Information
- Abstract
ISO/IEC 10967-1:2012 specifies properties of many of the integer and floating point datatypes available in a variety of programming languages in common use for mathematical and numerical applications. Its goal is to ensure that the properties of the arithmetic on a conforming datatype are made available to the programmer.
- Status
- Published
- Publication Date
- 10-Jul-2012
- Current Stage
- 9093 - International Standard confirmed
- Start Date
- 04-Mar-2024
- Completion Date
- 29-Aug-2026
Overview
ISO/IEC 10967-1:2012 - "Information technology - Language independent arithmetic - Part 1: Integer and floating point arithmetic" defines a language‑independent, parameterized model for the properties and behavior of integer and floating‑point datatypes used in numerical and mathematical programming. The standard specifies what arithmetic operations, datatype parameters and runtime information must be available to programmers, and requires documentation and notification mechanisms so numeric behavior is predictable and analyzable across platforms.
Keywords: ISO/IEC 10967-1:2012, language independent arithmetic, integer and floating point arithmetic, numeric datatypes, portability, IEC 60559, IEEE 754.
Key topics and technical requirements
- Datatype models and parameters: A parameterized description covering bounded/unbounded integers and floating‑point types (including radix‑2 and radix‑10 variants).
- Operations and semantics: Definitions for comparisons, basic arithmetic, value dissection/splitting, and conversions between numeric datatypes.
- Conformity and documentation: Requirements for platform and language processor documentation so implementers disclose arithmetic properties and parameter values.
- Notification model: Mechanisms for signaling exceptional conditions (e.g., overflow, inexact, underflow, infinities, NaNs) with alternatives such as recording indicators, altering control flow, or terminating with a message.
- Rounding and accuracy: Specification of rounding modes, rounding constants, and guidance on precision, accuracy and error propagation.
- Bindings and examples: Informative annexes include example language bindings (Ada, C, C++, Fortran, Common Lisp), sample conformity statements, and test programs for verifying platform acceptability.
- Compatibility with IEC 60559 (IEEE 754): The second edition tightens requirements to align more closely with IEC 60559 where applicable, while noting the standard does not guarantee bit‑for‑bit identical results across all platforms.
Practical applications and users
- Programming language standards committees - to express arithmetic semantics consistently.
- Compiler and runtime implementers - to expose runtime operations, parameters and correct notification behavior.
- Numerical library authors and scientific programmers - for predictable numerical behavior, conversions and error handling.
- Embedded and safety‑critical system developers - to document and verify numeric properties for certification and portability.
- Test and QA teams - to design validation tests and example programs (see Annex F) for platform acceptability.
Related standards
- IEC 60559 / IEEE 754 - floating‑point arithmetic (covered for conformity).
- ISO/IEC 10967 Parts 2 & 3 - Part 2: elementary numerical functions; Part 3: complex arithmetic and functions.
Adopting ISO/IEC 10967-1:2012 improves predictability, documentation, and portability of numeric software across diverse platforms while helping language standards define clearer arithmetic semantics.
Relations
- Effective Date
- 15-Apr-2008
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-1:2012 is a standard published by the International Organization for Standardization (ISO). Its full title is "Information technology — Language independent arithmetic — Part 1: Integer and floating point arithmetic". This standard covers: ISO/IEC 10967-1:2012 specifies properties of many of the integer and floating point datatypes available in a variety of programming languages in common use for mathematical and numerical applications. Its goal is to ensure that the properties of the arithmetic on a conforming datatype are made available to the programmer.
ISO/IEC 10967-1:2012 specifies properties of many of the integer and floating point datatypes available in a variety of programming languages in common use for mathematical and numerical applications. Its goal is to ensure that the properties of the arithmetic on a conforming datatype are made available to the programmer.
ISO/IEC 10967-1:2012 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-1:2012 has the following relationships with other standards: It is inter standard links to ISO/IEC 10967-1:1994. Understanding these relationships helps ensure you are using the most current and applicable version of the standard.
ISO/IEC 10967-1:2012 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-1
Second edition
2012-07-15
Information technology — Language
independent arithmetic —
Part 1:
Integer and floating point arithmetic
Technologies de l'information — Arithmétique indépendante de
langage —
Partie 1: Arithmétique de nombres entiers et en virgule flottante
Reference number
©
ISO/IEC 2012
© ISO/IEC 2012
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.org
Web www.iso.org
Published in Switzerland
ii © ISO/IEC 2012 – All rights reserved
© ISO/IEC 2012 – All rights reserved
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 denitions 4
4.1 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.1.1 Operators and relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.1.2 Sets and intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.1.3 Exceptional values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.1.4 Special values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.1.5 The Boolean datatype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.1.6 Operation specication framework . . . . . . . . . . . . . . . . . . . . . . . 6
4.2 Denitions of terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5 Specications for integer and
oating point datatypes and operations 12
5.1 Integer datatypes and operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.1.1 Integer result function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.1.2 Integer operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.1.2.1 Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.1.2.2 Basic arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.2 Floating point datatypes and operations . . . . . . . . . . . . . . . . . . . . . . . . 17
5.2.1 Conformity to IEC 60559 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2.2 Range and granularity constants . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2.3 Approximate operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2.4 Rounding and rounding constants . . . . . . . . . . . . . . . . . . . . . . . 20
5.2.5 Floating point result function . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.2.6 Floating point operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.2.6.1 Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.2.6.2 Basic arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.2.6.3 Value dissection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.2.6.4 Value splitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.3 Operations for conversion between numeric datatypes . . . . . . . . . . . . . . . . 29
5.3.1 Integer to integer conversions . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.3.2 Floating point to integer conversions . . . . . . . . . . . . . . . . . . . . . . 31
5.3.3 Integer to
oating point conversions . . . . . . . . . . . . . . . . . . . . . . 31
5.3.4 Floating point to
oating point conversions . . . . . . . . . . . . . . . . . . 32
5.3.5 Floating point to xed point conversions . . . . . . . . . . . . . . . . . . . . 32
5.3.6 Fixed point to
oating point conversions . . . . . . . . . . . . . . . . . . . . 34
5.4 Numerals as operations in a programming language . . . . . . . . . . . . . . . . . . 34
iii
© ISO/IEC 2012 – All rights reserved
5.4.1 Numerals for integer datatypes . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.4.2 Numerals for
oating point datatypes . . . . . . . . . . . . . . . . . . . . . 35
6 Notication 35
6.1 Model for handling of notications . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
6.2 Notication alternatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.2.1 Notication by recording in indicators . . . . . . . . . . . . . . . . . . . . . 36
6.2.2 Notication by alteration of control
ow . . . . . . . . . . . . . . . . . . . . 38
6.2.3 Notication by termination with message . . . . . . . . . . . . . . . . . . . 38
6.3 Delays in notication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.4 User selection of alternative for notication . . . . . . . . . . . . . . . . . . . . . . 39
7 Relationship with language standards 39
8 Documentation requirements 41
Annex A (informative) Partial conformity 43
A.1 Integer over
ow notication relaxation . . . . . . . . . . . . . . . . . . . . . . . . . 44
A.2 Innitary notication relaxation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
A.3 Inexact notication relaxation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
A.4 Under
ow notication relaxation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
A.5 Subnormal values relaxation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
A.6 Accuracy relaxation for add, subtract, multiply, and divide . . . . . . . . . . . . . 45
A.7 Accuracy relaxation for
oating point conversion . . . . . . . . . . . . . . . . . . . 47
Annex B (informative) IEC 60559 bindings 51
B.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
B.2 Notication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Annex C (informative) Rationale 57
C.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
C.1.1 Inclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
C.1.2 Exclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
C.1.3 Companion parts to this part . . . . . . . . . . . . . . . . . . . . . . . . . . 58
C.2 Conformity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
C.2.1 Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
C.3 Normative references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
C.4 Symbols and denitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
C.4.1 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
C.4.2 Denitions of terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
C.5 Specications for integer and
oating point datatypes and operations . . . . . . . . 61
C.5.1 Integer datatypes and operations . . . . . . . . . . . . . . . . . . . . . . . . 62
C.5.1.0.1 Unbounded integers . . . . . . . . . . . . . . . . . . . . . 62
C.5.1.0.2 Bounded non-modulo integers . . . . . . . . . . . . . . . 63
C.5.1.0.3 Modulo integers . . . . . . . . . . . . . . . . . . . . . . . 64
C.5.1.1 Integer result function . . . . . . . . . . . . . . . . . . . . . . . . . 64
C.5.1.2 Integer operations . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
C.5.1.2.1 Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . 64
C.5.1.2.2 Basic arithmetic . . . . . . . . . . . . . . . . . . . . . . . 65
iv
© ISO/IEC 2012 – All rights reserved
C.5.2 Floating point datatypes and operations . . . . . . . . . . . . . . . . . . . . 65
C.5.2.0.1 Constraints on the
oating point parameters . . . . . . . 66
C.5.2.0.2 Radix complement
oating point . . . . . . . . . . . . . . 68
C.5.2.1 Conformity to IEC 60559 . . . . . . . . . . . . . . . . . . . . . . . 68
C.5.2.1.1 Subnormal numbers . . . . . . . . . . . . . . . . . . . . . 69
C.5.2.1.2 Signed zero . . . . . . . . . . . . . . . . . . . . . . . . . . 69
C.5.2.1.3 Innities and NaNs . . . . . . . . . . . . . . . . . . . . . 69
C.5.2.2 Range and granularity constants . . . . . . . . . . . . . . . . . . . 70
C.5.2.2.1 Relations among
oating point datatypes . . . . . . . . . 70
C.5.2.3 Approximate operations . . . . . . . . . . . . . . . . . . . . . . . . 71
C.5.2.4 Rounding and rounding constants . . . . . . . . . . . . . . . . . . 71
C.5.2.5 Floating point result function . . . . . . . . . . . . . . . . . . . . . 73
C.5.2.6 Floating point operations . . . . . . . . . . . . . . . . . . . . . . . 73
C.5.2.6.1 Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . 73
C.5.2.6.2 Basic arithmetic . . . . . . . . . . . . . . . . . . . . . . . 73
C.5.2.6.3 Value dissection . . . . . . . . . . . . . . . . . . . . . . . 74
C.5.2.6.4 Value splitting . . . . . . . . . . . . . . . . . . . . . . . . 74
C.5.2.7 Levels of predictability . . . . . . . . . . . . . . . . . . . . . . . . 75
C.5.2.8 Identities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
C.5.2.9 Precision, accuracy, and error . . . . . . . . . . . . . . . . . . . . . 78
C.5.2.9.1 LIA-1 and error . . . . . . . . . . . . . . . . . . . . . . . 79
C.5.2.9.2 Empirical and modelling errors . . . . . . . . . . . . . . . 80
C.5.2.9.3 Propagation of errors . . . . . . . . . . . . . . . . . . . . 80
C.5.2.10 Extra precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
C.5.3 Operations for conversion between numeric datatypes . . . . . . . . . . . . 82
C.5.4 Numerals as operations in a programming language . . . . . . . . . . . . . 83
C.5.4.1 Numerals for integer datatypes . . . . . . . . . . . . . . . . . . . . 83
C.5.4.2 Numerals for
oating point datatypes . . . . . . . . . . . . . . . . 83
C.6 Notication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
C.6.1 Model handling of notications . . . . . . . . . . . . . . . . . . . . . . . . . 84
C.6.2 Notication alternatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
C.6.2.1 Notication by recording in indicators . . . . . . . . . . . . . . . . 84
C.6.2.2 Notication by alteration of control
ow . . . . . . . . . . . . . . . 85
C.6.2.3 Notication by termination with message . . . . . . . . . . . . . . 86
C.6.3 Delays in notication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
C.6.4 User selection of alternative for notication . . . . . . . . . . . . . . . . . . 86
C.7 Relationship with language standards . . . . . . . . . . . . . . . . . . . . . . . . . 87
C.8 Documentation requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Annex D (informative) Example bindings for specic languages 89
D.1 Ada . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
D.2 C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
D.3 C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
D.4 Fortran . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
D.5 Common Lisp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Annex E (informative) Example of a conformity statement 121
E.1 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
v
© ISO/IEC 2012 – All rights reserved
E.2 Integer parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
E.3 Floating point parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
E.4 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
E.5 Notication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Annex F (informative) Example programs 125
F.1 Verifying platform acceptability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
F.2 Selecting alternate code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
F.3 Terminating a loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
F.4 Estimating error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
F.5 Saving exception state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
F.6 Fast versus accurate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
F.7 High-precision multiply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Bibliography 129
vi
© ISO/IEC 2012 – All rights reserved
Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical
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 fields of technical activity.
ISO and IEC technical committees collaborate in fields of mutual interest. Other international
organizations, governmental and non-governmental, in liaison with ISO and IEC, also take part in the
work. In the field of information technology, ISO and IEC have established a joint technical committee,
ISO/IEC JTC 1.
International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 2.
The main task of the joint technical committee is to prepare International Standards. 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 document may be the subject of
patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.
ISO/IEC 10967-1 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology,
Subcommittee SC 22, Programming languages, their environments and system software interfaces.
This second edition cancels and replaces the first edition (ISO/IEC 10967-1:1994), which has been
technically revised.
ISO/IEC 10967-1 consists of the following parts, under the general title Information technology —
Language independent arithmetic:
Part 1: Integer and floating point arithmetic
Part 2: Elementary numerical functions
Part 3: Complex integer and floating point arithmetic and complex elementary numerical functions
vii
© ISO/IEC 2012 – All rights reserved
Introduction
The aims
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 datatypes by a conforming language processor.
It is the intent of this part of ISO/IEC 10967 to help to redress these shortcomings, by setting
out precise denitions of integer and
oating point datatypes, and requirements for documentation.
It is not claimed that this part of ISO/IEC 10967 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.
The rst aim of this part of ISO/IEC 10967 is to enhance the predictability and reliability of
the behaviour of programs performing numeric processing.
The second aim, which helps to support the rst, is to help programming language standards
to express the semantics of arithmetic datatypes.
The third aim is to help enhance the portability of programs that perform numeric processing
across a range of dierent platforms. Improved predictability of behaviour will aid programmers
designing code intended to run on multiple platforms, and will help in predicting what will happen
when such a program is moved from one conforming language processor to another.
Note that this part of ISO/IEC 10967 does not attempt to ensure bit-for-bit identical results
when programs are transferred between language processors, or translated from one language into
another. However, experience shows that diverse numeric environments can yield comparable
results under most circumstances, and that with careful program design signicant portability is
actually achievable. In addition, the IEC 60559 (IEEE 754) standard goes a long way to ensure bit-
for-bit identical results, and in this second edition of this part of ISO/IEC 10967 the requirements
are tightened (compared to the rst edition) to approach those of IEEE 754.
The content
This part of ISO/IEC 10967 denes the fundamental properties of integer and
oating point
datatypes. These properties are presented in terms of a parameterised model. The parameters
allow enough variation in the model so that several integer and
oating point datatypes are
covered. In particular, the IEC 60559 (IEEE 754)
oating point datatypes, both those of radix 2
and those of radix 10, are covered, as well as integer datatypes, both unlimited and limited, for
the latter both signed or unsigned, are covered. But when a particular set of parameter values is
selected, and all required documentation is supplied, the resulting information should be precise
enough to permit careful numerical analysis.
The requirements of this part of ISO/IEC 10967 cover four areas. First, the programmer must
be given runtime access to the specied operations on values of integer or
oating point datatype.
Second, the programmer must be given runtime access to the parameters (and parameter func-
tions) that describe the arithmetic properties of an integer or
oating point datatype. Third,
the executing program must be notied when proper results cannot be returned (e.g., when a
viii
© ISO/IEC 2012 – All rights reserved
computed result may be out of range or undened). Fourth, the numeric properties of conforming
platforms must be publicly documented.
This part of ISO/IEC 10967 focuses on the classical integer and
oating point datatypes.
Subsequent parts considers common elementary numerical functions (Part 2), complex numerical
numbers and complex elementary numerical functions (Part 3).
The benets
Adoption and proper use of this part of ISO/IEC 10967 can lead to the following benets.
For programming language standards it will be possible to dene their arithmetic semantics
more precisely without preventing the ecient implementation of the language on a wide range
of machine architectures.
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.
In programs one will be able to determine (at run time) the crucial numeric properties of
the implementation. 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.
ix
INTERNATIONAL STANDARD ISO/IEC 10967-1:2012(E)
Information technology |
Language independent arithmetic |
Part 1: Integer and
oating point arithmetic
1 Scope
This part of ISO/IEC 10967 species properties of many of the integer and
oating point datatypes
available in a variety of programming languages in common use for mathematical and numerical
applications.
It is not the purpose of this part of ISO/IEC 10967 to ensure that an arbitrary numerical
function can be so encoded as to produce acceptable results on all conforming datatypes. Rather,
the goal is to ensure that the properties of the arithmetic on a conforming datatype are made
available to the programmer. Therefore, it is not reasonable to demand that a substantive piece of
software run on every implementation that can claim conformity to this part of ISO/IEC 10967.
An implementor may choose any combination of hardware and software support to meet the
specications of this part of ISO/IEC 10967. It is the datatypes and operations on values of those
datatypes, of the computing environment as seen by the programmer/user, that does or does not
conform to the specications.
The term implementation (of this part of ISO/IEC 10967) denotes the total computing en-
vironment pertinent to this part of ISO/IEC 10967, including hardware, language processors,
subroutine libraries, exception handling facilities, other software, and documentation.
1.1 Inclusions
This part of ISO/IEC 10967 provides specications for properties of integer and
oating point
datatypes as well as basic operations on values of these datatypes. Specications are included
for bounded and unbounded integer datatypes, as well as
oating point datatypes. Boundaries
for the occurrence 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 (not-a-number), is prescribed for each specied
oating point operation.
This part of ISO/IEC 10967 provides specications for:
a) The set of required values of the arithmetic datatype.
b) A number of arithmetic operations, including:
1) comparison operations on two operands of the same type,
2) primitive operations (addition, subtraction, etc.) with operands of the same type,
3) operations that access properties of individual values,
1. Scope 1
© ISO/IEC 2012 – All rights reserved
4) conversion operations of a value from one arithmetic datatype to another arithmetic
datatype, where at least one of the datatypes is conforming to this part of ISO/IEC
10967, and
5) numerals for all values specied by this part of ISO/IEC 10967 for a conforming
datatype.
This part of ISO/IEC 10967 also provides specications for:
c) The results produced by an included
oating point operation when one or more argument
values are IEC 60559 special values.
d) Program-visible parameters that characterise the values and certain aspects of the operations
of an arithmetic datatype.
e) Methods for reporting arithmetic exceptions.
1.2 Exclusions
This part of ISO/IEC 10967 provides no specications for:
a) Arithmetic and comparison operations whose operands are of more than one datatype. This
part of ISO/IEC 10967 neither requires nor excludes the presence of such \mixed operand"
operations.
b) An interval datatype, or the operations on such data. This part of ISO/IEC 10967 neither
requires nor excludes such data or operations.
c) A xed point datatype, or the operations on such data. This part of ISO/IEC 10967 neither
requires nor excludes such data or operations.
d) A rational datatype, or the operations on such data. This part of ISO/IEC 10967 neither
requires nor excludes such data or operations.
e) The properties of arithmetic datatypes that are not related to the numerical process, such
as the representation of values on physical media.
f) 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, including the
precedence of operators 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 presence or absence of automatic datatype coercions, and the consequences of
applying an operation to values of improper type, or to uninitialised data,
4) the rules for assignment, parameter passing, and returning value.
NOTE { See Clause 7 and Annex D for a discussion of language standards and language
bindings.
The internal representation of values is beyond the scope of this standard. E.g., the value
of the exponent bias, if any, is not specied, nor available as a parameter specied by this part
2 Scope
© ISO/IEC 2012 – All rights reserved
of ISO/IEC 10967. Internal representations need not be unique, nor is there a requirement for
identiable elds (for sign, exponent, and so on).
Furthermore, this part of ISO/IEC 10967 does not provide specications for how the operations
should be implemented 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.
A binding standard species the correspondence between one or more of the arithmetic data-
types, parameters, and operations specied in this part of ISO/IEC 10967 and the concrete lan-
guage syntax of some programming language. More generally, a binding standard species the
correspondence between certain datatypes, parameters, and operations and the elements of some
arbitrary computing entity. A language standard that explicitly 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 of ISO/IEC 10967 if and only if it conforms to the binding standard. In the case
of con
ict between a binding standard and this part of ISO/IEC 10967, the specications of the
binding standard takes precedence.
When a binding standard requires only a subset of the integer or
oating point datatypes
provided, an implementation remains free to conform to this part of ISO/IEC 10967 with respect
to other datatypes independently of that binding standard.
When a binding standard requires only a subset of the operations specied in this part of
ISO/IEC 10967, an implementation remains free to conform to this part of ISO/IEC 10967 with
respect to other datatypes and operations, independently of that binding standard.
When no binding standard exists, an implementation conforms to this part of ISO/IEC 10967
if and only if it provides one or more datatypes and operations that together satisfy all the
requirements of Clauses 5 through 8 that are relevant to those datatypes and operations. The
implementation shall then document the binding.
Conformity to this part of ISO/IEC 10967 is always with respect to a specied set of data-
types and set of operations. Under certain circumstances, conformity to IEC 60559 is implied by
conformity to this part of ISO/IEC 10967.
An implementation is free to provide arithmetic datatypes and arithmetic operations that do
not conform to this part of ISO/IEC 10967 or that are beyond the scope of this part of ISO/IEC
10967. The implementation shall not claim conformity to this part of ISO/IEC 10967 for such
datatypes or operations.
An implementation is permitted to have modes of operation that do not conform to this part of
ISO/IEC 10967. 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 of ISO/IEC
10967 should be the default mode of operation.
2. Conformity 3
© ISO/IEC 2012 – All rights reserved
NOTES
1 Language bindings are essential. Clause 8 requires an implementation to supply a binding
if no binding standard exists. See Annex C.7 for recommendations on the proper content
of a binding standard, Annex E for an example of a conformity statement, and Annex D
for suggested language bindings.
2 A complete binding for this part of ISO/IEC 10967 may include (explicitly or by reference)
a binding for IEC 60559 as well. See 5.2.1 and Annex B.
3 It is not possible to conform to this part of ISO/IEC 10967 without specifying to which
datatypes and set of operations, and modes of operation, conformity is claimed.
4 This part of ISO/IEC 10967 requires that certain integer operations are made available for a
conforming integer datatype, and that certain
oating point operations are made available
for a conforming
oating point datatype.
5 All the operations specied in this part of ISO/IEC 10967 for a datatype must be provided
for a conforming datatype, in a conforming mode of operation for that datatype.
3 Normative references
The following referenced documents are indispensable for the application of this part of ISO/IEC
10967. For dated references, only the edition cited applies. For undated references, the latest
edition of the referenced document (including any amendments) applies.
IEC 60559, Standard for
oating-point arithmetic.
4 Symbols and denitions
4.1 Symbols
For the purposes of this document, the following symbols are used.
4.1.1 Operators and relations
All prex and inx operators have their conventional exact mathematical meaning. In particular,
this document uses:
) and, for logical implication and equivalence
+,, =,jxj,bxc,dxe, and round(x) on real values
for multiplication on real values
<,6,>, and > between real values
= and6= between real as well as special values
max on non-empty upwardly closed sets of real values
min on non-empty downwardly closed sets of real values
[,\,2,62,,,*, =, and6= with sets
for the Cartesian product of sets
! for a mapping between sets
j for the divides relation between integer values
p
y
x , x, log (x) on real values
b
4 Symbols and denitions
© ISO/IEC 2012 – All rights reserved
NOTE 1 { is used informally, in notes and the rationale.
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
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 2 { ijj is true exactly when j=i is dened and j=i2Z.
4.1.2 Sets and intervals
In this document,Z denotes the set of mathematical integers,R denotes the set of real numbers,
andC denotes the set of complex numbers overR. Note thatZRC.
The conventional notation for set denition and for set operations are used.
The following notation for intervals is used in this document:
[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.3 Exceptional values
The parts of ISO/IEC 10967 use the following six exceptional values:
a) inexact: the result is rounded and dierent from the exact result.
b) under
ow: the absolute value of the unrounded result is less than the smallest normal
value, and the rounded result may have lost accuracy due to the denormalisation (more
than lost by ordinary rounding if the exponent range was unbounded).
c) over
ow: the rounded result (when rounding as if the exponent range was unbounded) is
larger than what can be represented in the result datatype.
d) innitary: the corresponding mathematical function has a pole at the nite argument
point, or the result is otherwise innite from nite arguments.
NOTE { innitary is a generalisation of divide by zero.
e) invalid: the operation is undened but not innitary, or the result is inC but not inR, for
the given arguments.
4.1.2 Sets and intervals 5
© ISO/IEC 2012 – All rights reserved
f) absolute precision under
ow: indicates that at least one argument is such that the
density of representable values is too low in the neighbourhood of the given argument value
for a numeric result to be considered appropriate to return. This exceptional value is used for
operations that approximate trigonometric functions (Part 2 and Part 3) and for operations
that that approximate complex hyperbolic and exponentiation functions (Part 3).
For the exceptional values, a continuation value may be given in ISO/IEC 10967 in parenthesis
after the exceptional value.
4.1.4 Special values
The following symbols represent special values dened in IEC 60559 and are used in ISO/IEC
10967:
0, +++111,111, qNaN, and sNaN.
These values are not part of I or F (see Clauses 5.1 and 5.2 for a denition of these datatypes),
but if
hasinf
I
(see Clause 5.1) has the value true, the +++111,111 values are included in the integer datatype
in the implementation that corresponds to I, and if iec 60559 (see Clause 5.2.1) has the value
F
true, all these special values are included in the
oating point datatype in the implementation
that corresponds to F .
NOTE { This document 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 for
oating point operations 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, 0 shall be
used as the actual result or continuation value. If an implementation is not capable of representing
a prescribed result or continuation value of the IEC 60559 special values +++111,111, or qNaN, the
actual result or continuation value is binding or implementation dened.
4.1.5 The Boolean datatype
The datatype Boolean consists of the two values true and false.
NOTE { Mathematical relations are true or false (or undened, if an operand is undened),
which are abstract conditions, not values in a datatype. In contrast, true and false are values
in Boolean.
4.1.6 Operation specication framework
Each of the operations are specied using a mathematical notation with cases. Each case condition
is intended to be disjoint with the other cases, and encompass all non-special values as well as
some of the special values.
Mathematically, each argument to an operation is a pair of a value and a set of exceptional
values and likewise for the return value. However, in most cases only the rst part of this pair is
6 Symbols and denitions
© ISO/IEC 2012 – All rights reserved
written out in the specications. The set of exceptional values returned from an operation is at
least the union of the set of exceptional values from the arguments. Any new exceptional value
that the operation itself gives rise to is given in the form exceptional value(continuation value)
indicating that the second (implicit) part of the mathematical return value not only is the union
of the second (implicit) parts of the arguments, but in addition is unioned with the singleton set
of the given exceptional value, or, in the case of under
ow or over
ow, the set of the given
exceptional value and inexact.
In an implementation, the exceptional values usually do not accompany each argument and
return value, but are instead handled as notications. See Clause 6.
When not communicating values, notications shall be internal to each computational thread,
whether threads are explicit or implicit in the program as seen by the programmer.
When communicating values, if the value sending thread has notications that may be relevant
for a communicated values these notications should be communicated to a receiving thread along
with values (of any datatype, not just numeric ones). In such instances, the exceptional values
are associated with the value, even though it may pick up notications in the thread that arose
for a dierent computation in that thread and were not cleared.
NOTES
1 If notications were arbitrarily seen in other threads, it would be very dicult to know which
computation (thread) it is that might have caused the notication, and thus may trigger
notication handling when not appropriate in an unrelated thread. Therefore it is essential
that notications are internal to each computational thread, when not communicating a
value.
2 If notications (normally recorded in indicators) are trimmed away when communicating a
value (of whatever type) to another thread, that can result in the failure to cause notication
handling when that would have been appropriate. Not communicating notications between
communicating threads thus goes against a goal set out in the introduction, namely \the
executing program must be notied when proper results cannot be returned (e.g., when a
computed result may be out of range or undened)".
However, many existing methods for remote procedure calling, or thread communication,
do not communicate notications (even when they are recorded in indicators).
4.2 Denitions of terms
For the purposes of this document, the following terms and denitions apply.
4.2.1
accuracy
closeness between the true mathematical result and a computed result
4.2.2
arithmetic datatype
datatype whose non-special values are members ofZ,R, orC
4.2.3
continuation value
computational value used as the result of an arithmetic operation when an exception occurs
4.2 Denitions of terms 7
© ISO/IEC 2012 – All rights reserved
Continuation values are intended to be used in subsequent arithmetic processing. A continua-
tion value can be a (in the datatype representable) value inR or be an IEC 60559 special value.
(Contrast with exceptional value. See Clause 6.2.1.)
4.2.4
denormalisation
inclusion of lead zero digits, with corresponding adjustment of the exponent
Denormalisation is logically done before rounding (otherwise there may be double rounding,
that is rounding done twice with slightly dierent rounding functions, and that would be noncon-
forming). It may be done in order to get the exponent (just) within representable range.
4.2.5
denormalisation loss
larger than normal rounding error caused by the fact that denormalisation plus rounding may lose
precision more than only rounding would do if the target exponent range was unbounded
See Clause 5.2.4 for a full denition.
4.2.6
error
hin computed valuei dierence between a computed value and the mathematically correct value
Used in phrases like \rounding error" or \error bound".
4.2.7
error
hcomputation gone awryi exception
Used in phrases like \error message" or \error output". Error and exception are not synonyms
in any other contexts.
4.2.8
exception
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 (e.g., at a
pole), invalid (e.g., when the true result is inC but not inR)), or because the mathematical
result cannot, or might not, be representable with sucient accuracy (under
ow, over
ow) or
viability (absolute precision under
ow).
NOTES
1 absolute precision under
ow is not used in this document, but is used in Part 2 (and
thereby also in Part 3).
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 notication han-
dling will be referred to as \[programming language name] exception", when referred to,
particularly in Annex D.
8 Symbols and denitions
© ISO/IEC 2012 – All rights reserved
4.2.9
exceptional value
non-numeric value produced (in the specication model) by an arithmetic operation to indicate
the occurrence of an exception (or the inexactness of the result)
Exceptional values are not used in subsequent arithmetic processing. (See Clause 5.)
NOTES
3 Exceptional values are used as a dening formalism only. With respect to this document,
they do not represent values of any of the datatypes described. There is no requirement
that they be represented or stored in the computing system.
4 Exceptional values are not to be confused with the NaNs and innities dened in IEC 60559.
Contrast this denition with that of continuation value above.
4.2.10
helper function
function used solely to aid in the expression of a requirement
Helper functions are not accessible to the programmer, and are not required to be part of an
implementation.
4.2.11
implementation (of this document)
total arithmetic environment presented to a programmer, including hardware, language processors,
exception handling facilities, subroutine libraries, other software, and all pertinent documentation
4.2.12
literal
single syntactic entity denoting a constant value
4.2.13
normal value
non-special and non-subnormal value of a
oating point datatype F
See F in Clause 5.2 for a full denition.
N
4.2.14
notication
process by which a program (or that program's user) is informed that an arithmetic exception has
occurred
For example, dividing 2 by 0 results in a notication for innitary. See Clause 6 for details.
4.2.15
numeral
numeric literal
It may denote a value inZ orR,0, an innity, or a NaN.
4.2 Denitions of terms 9
© ISO/IEC 2012 – All rights reserved
4.2.16
operation
function that is intended to be made directly available to the programmer
As opposed to helper functions or theoretical mathematical functions.
4.2.17
pole
argument,x , where a given mathematical function,f, is dened, nite, monotone, and continuous
in at least one one path of approach towards x , and where lim f(x) is innite
x!x
4.2.18
precision
number of digits in the fraction of a
oating point number
(See Clause 5.2.)
4.2.19
rounding
act of computing a result for an operation that is close to the exact result for that operation, but
that does not have digits beyond what the target datatype can represent
Note that a suitable representable result may not exist (see Clause 5.2.5).
4.2.20
rounding function
function, rnd :R!X, (where X is a given discrete and unlimited subset ofR) that maps each
element of X to itself, and is monotonic non-decreasing
Formally, if x and y are inR,
x2X)rnd(x) =x
x
Note that if u is between two adjacent values in X, rnd(u) selects one of those adjacent values.
4.2.21
round to nearest
rounding function, rnd, that when u2R is strictly between two adjacent values in X, rnd(u)
selects the one nearest u, but if the adjacent values are equidistant from u, either value can be
chosen deterministically but in such a way that sign symmet
...



