BS ISO IEC 10967-1-2012 Information technology Language independent arithmetic Integer and floating point arithmetic《信息技术 语言独立计算 整数和浮点算法》.pdf

上传人:roleaisle130 文档编号:396209 上传时间:2018-10-18 格式:PDF 页数:148 大小:3.99MB
下载 相关 举报
BS ISO IEC 10967-1-2012 Information technology Language independent arithmetic Integer and floating point arithmetic《信息技术 语言独立计算 整数和浮点算法》.pdf_第1页
第1页 / 共148页
BS ISO IEC 10967-1-2012 Information technology Language independent arithmetic Integer and floating point arithmetic《信息技术 语言独立计算 整数和浮点算法》.pdf_第2页
第2页 / 共148页
BS ISO IEC 10967-1-2012 Information technology Language independent arithmetic Integer and floating point arithmetic《信息技术 语言独立计算 整数和浮点算法》.pdf_第3页
第3页 / 共148页
BS ISO IEC 10967-1-2012 Information technology Language independent arithmetic Integer and floating point arithmetic《信息技术 语言独立计算 整数和浮点算法》.pdf_第4页
第4页 / 共148页
BS ISO IEC 10967-1-2012 Information technology Language independent arithmetic Integer and floating point arithmetic《信息技术 语言独立计算 整数和浮点算法》.pdf_第5页
第5页 / 共148页
亲,该文档总共148页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、raising standards worldwide NO COPYING WITHOUT BSI PERMISSION EXCEPT AS PERMITTED BY COPYRIGHT LAW BSI Standards Publication BS ISO/IEC 10967-1:2012 Information technology Language independent arithmetic Part 1: Integer and floating point arithmeticBS ISO/IEC 10967-1:2012 BRITISH STANDARD National f

2、oreword This British Standard is the UK implementation of ISO/IEC 10967-1:2012. It supersedes BS ISO/IEC 10967-1:1994 which is withdrawn. The UK participation in its preparation was entrusted to Technical Committee IST/5, Programming languages, their environments and system software interfaces. A li

3、st of organizations represented on this committee can be obtained on request to its secretary. This publication does not purport to include all the necessary provisions of a contract. Users are responsible for its correct application. The British Standards Institution 2012. Published by BSI Standard

4、s Limited 2012 ISBN 978 0 580 63696 7 ICS 35.060 Compliance with a British Standard cannot confer immunity from legal obligations. This British Standard was published under the authority of the Standards Policy and Strategy Committee on 31 July 2012. Amendments issued since publication Date Text aff

5、ectedBS ISO/IEC 10967-1:2012Reference number ISO/IEC 10967-1:2012(E) ISO/IEC 2012INTERNATIONAL STANDARD ISO/IEC 10967-1 Second edition 2012-07-15 Information technology Language independent arithmetic Part 1: Integer and floating point arithmetic Technologies de linformation Arithmtique indpendante

6、de langage Partie 1: Arithmtique de nombres entiers et en virgule flottante BS ISO/IEC 10967-1:2012 ISO/IEC 10967-1:2012(E) COPYRIGHT PROTECTED DOCUMENT 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

7、, electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or ISOs 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 copyrig

8、htiso.org Web www.iso.org Published in Switzerland ii ISO/IEC 2012 All rights reservedBS ISO/IEC 10967-1:2012 Contents Foreword vii Introduction viii 1 Scope 1 1.1 Inclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Exclusions . . . . . . . . . . . . .

9、. . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Conformity 3 3 Normative references 4 4 Symbols and denitions 4 4.1 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4.1.1 Operators and relations . . . . . . . . . . . . . . . . . . . . . . . .

10、. . . . . 4 4.1.2 Sets and intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.1.3 Exceptional values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.1.4 Special values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4.1.5 The B

11、oolean datatype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4.1.6 Operation specication framework . . . . . . . . . . . . . . . . . . . . . . . 6 4.2 Denitions of terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 5 Specications for integer and oating p

12、oint datatypes and operations 12 5.1 Integer datatypes and operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 5.1.1 Integer result function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 5.1.2 Integer operations . . . . . . . . . . . . . . . . . . . . . . . . . . .

13、 . . . . . 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

14、60559 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.2.2 Range and granularity constants . . . . . . . . . . . . . . . . . . . . . . . . 19 5.2.3 Approximate operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.2.4 Rounding and rounding constants . . . . . . . . .

15、. . . . . . . . . . . . . . 20 5.2.5 Floating point result function . . . . . . . . . . . . . . . . . . . . . . . . . . 21 5.2.6 Floating point operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.2.6.1 Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.2

16、.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 data

17、types . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . .

18、. . . . . 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 opera

19、tions in a programming language . . . . . . . . . . . . . . . . . . 34 iii ISO/IEC 10967-1:2012(E) ISO/IEC 2012 All rights reservedBS ISO/IEC 10967-1:2012 5.4.1 Numerals for integer datatypes . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.4.2 Numerals for oating point datatypes . . . . . . .

20、 . . . . . . . . . . . . . . 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 . . . . . . . .

21、. . . . . . . . . . . . . 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

22、 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 overow notication relaxation . . . . . . . . . . . . . . . . . . . . . .

23、. . . 44 A.2 Innitary notication relaxation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 A.3 Inexact notication relaxation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 A.4 Underow notication relaxation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 A.5 Sub

24、normal 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) IE

25、C 60559 bindings 51 B.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 B.2 Notication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Annex C (informative) Rationale 57 C.1 Scope . . . . . . . . . . . . . . . . . . . .

26、. . . . . . . . . . . . . . . . . . . . . . . 57 C.1.1 Inclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 C.1.2 Exclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 C.1.3 Companion parts to this part . . . . . . . . . . . . . .

27、. . . . . . . . . . . . 58 C.2 Conformity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 C.2.1 Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 C.3 Normative references . . . . . . . . . . . . . . . . . . . . . . . . . . . .

28、. . . . . . . 59 C.4 Symbols and denitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 C.4.1 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 C.4.2 Denitions of terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 C.5 S

29、pecications 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 . . . . . . .

30、 . . . . . . . . 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 . . . . . . .

31、. . . . . . . . . . . . . . . . . . 64 C.5.1.2.2 Basic arithmetic . . . . . . . . . . . . . . . . . . . . . . . 65 iv ISO/IEC 10967-1:2012(E) ISO/IEC 2012 All rights reservedBS ISO/IEC 10967-1:2012 C.5.2 Floating point datatypes and operations . . . . . . . . . . . . . . . . . . . . 65 C.5.2.0.1 Con

32、straints 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 z

33、ero . . . . . . . . . . . . . . . . . . . . . . . . . . 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 Approxima

34、te 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 . . . . . . . . . . . . . . . . . . .

35、. . . . 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 . . . . . . . . . . . . . . . . . .

36、. . . . . . 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 . . .

37、 . . . . . . . . . . . . . . . . . . . . 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

38、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 . . . . . . . . . . . . .

39、. . . 83 C.6 Notication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 C.6.1 Model handling of notications . . . . . . . . . . . . . . . . . . . . . . . . . 84 C.6.2 Notication alternatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 C.6.2.1 Notic

40、ation 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 . . . . . . . . . . . . . . . . . . . . . . . .

41、 . . . . . . . 86 C.6.4 User selection of alternative for notication . . . . . . . . . . . . . . . . . . 86 C.7 Relationship with language standards . . . . . . . . . . . . . . . . . . . . . . . . . 87 C.8 Documentation requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Anne

42、x D (informative) Example bindings for specic languages 89 D.1 Ada . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 D.2 C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 D.3 C+ . . . . . . . . . . . . . . . . .

43、. . . . . . . . . . . . . . . . . . . . . . . . . . . 104 D.4 Fortran . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 D.5 Common Lisp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Annex E (informative) Example of a conformit

44、y statement 121 E.1 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 v ISO/IEC 10967-1:2012(E) ISO/IEC 10967-1:2012(E) ISO/IEC 2012 All rights reservedBS ISO/IEC 10967-1:2012 E.2 Integer parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . .

45、 . . . . . . . . 121 E.3 Floating point parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 E.4 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 E.5 Notication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

46、. . . . . . . 122 Annex F (informative) Example programs 125 F.1 Verifying platform acceptability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 F.2 Selecting alternate code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 F.3 Terminating a loop . . . . . . . . .

47、. . . . . . . . . . . . . . . . . . . . . . . . . . . 126 F.4 Estimating error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 F.5 Saving exception state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 F.6 Fast versus accurate . . . . . . . . . .

48、 . . . . . . . . . . . . . . . . . . . . . . . . . 127 F.7 High-precision multiply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Bibliography 129 vi ISO/IEC 10967-1:2012(E) ISO/IEC 2012 All rights reservedBS ISO/IEC 10967-1:2012 vii Foreword ISO (the International Organizatio

49、n 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-govern

展开阅读全文
相关资源
  • BS ISO IEC 29150-2011 Information technology Security techniques Signcryption《信息技术 安全技术 签密》.pdfBS ISO IEC 29150-2011 Information technology Security techniques Signcryption《信息技术 安全技术 签密》.pdf
  • BS ISO IEC 15408-1-2009 Information technology - Security techniques - Evaluation criteria for IT Security - Introduction and general model《信息技术 安全技术 IT安全评价准则 一.pdfBS ISO IEC 15408-1-2009 Information technology - Security techniques - Evaluation criteria for IT Security - Introduction and general model《信息技术 安全技术 IT安全评价准则 一.pdf
  • BS ISO 7295-1988+A1-2014 Tyre valves for aircraft Interchangeability dimensions《飞机轮胎汽门嘴 互换性尺寸》.pdfBS ISO 7295-1988+A1-2014 Tyre valves for aircraft Interchangeability dimensions《飞机轮胎汽门嘴 互换性尺寸》.pdf
  • BS ISO 15118-1-2013 Road vehicles Vehicle to grid communication interface General information and use-case definition《道路车辆 车辆到电力通讯接口 通用信息和使用案例定义》.pdfBS ISO 15118-1-2013 Road vehicles Vehicle to grid communication interface General information and use-case definition《道路车辆 车辆到电力通讯接口 通用信息和使用案例定义》.pdf
  • BS ISO 13765-2-2004 Refractory mortars - Determination of consistency using the reciprocating flow table method《耐熔灰浆 使用往复流动表法测定一致性》.pdfBS ISO 13765-2-2004 Refractory mortars - Determination of consistency using the reciprocating flow table method《耐熔灰浆 使用往复流动表法测定一致性》.pdf
  • BS ISO 10998-2008+A1-2014 Agricultural tractors Requirements for steering《农业拖拉机 操纵要求》.pdfBS ISO 10998-2008+A1-2014 Agricultural tractors Requirements for steering《农业拖拉机 操纵要求》.pdf
  • BS Z 9-1998 Space data and information transfer systems - Advanced orbiting systems - Networks and data links - Architectural specification《空间数据和信息传输系统 高级轨道系统 网络和数据链接 结构规范》.pdfBS Z 9-1998 Space data and information transfer systems - Advanced orbiting systems - Networks and data links - Architectural specification《空间数据和信息传输系统 高级轨道系统 网络和数据链接 结构规范》.pdf
  • BS Z 7-1998 Space data and information transfer systems - ASCII encoded English《空间数据和信息传输系统 ASCII 编码英语》.pdfBS Z 7-1998 Space data and information transfer systems - ASCII encoded English《空间数据和信息传输系统 ASCII 编码英语》.pdf
  • BS Z 5-1997 Space data and information transfer systems - Standard formatted data units - Control authority procedures《航天数据和信息发送系统 标准格式数据单元 控制授权程序》.pdfBS Z 5-1997 Space data and information transfer systems - Standard formatted data units - Control authority procedures《航天数据和信息发送系统 标准格式数据单元 控制授权程序》.pdf
  • BS Z 4-1997 Space data and information transfer systems - Standard formatted data units - Structure and construction rules《航天数据和信息传输系统 标准格式数据单元 结构和构造规则》.pdfBS Z 4-1997 Space data and information transfer systems - Standard formatted data units - Structure and construction rules《航天数据和信息传输系统 标准格式数据单元 结构和构造规则》.pdf
  • 猜你喜欢
    相关搜索

    当前位置:首页 > 标准规范 > 国际标准 > BS

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1