Download presentation

Presentation is loading. Please wait.

Published byPedro Pernell Modified about 1 year ago

1
Changes to TS 18661 Part 3 Interchange and extended types WG 14 N1796 2014-04-07

2
Part 3 draft N1796 TS 18661 Part 3 is C support for new IEC 60559 formats N1796 updates N1758 discussed in Chicago Goal: show changes, consider for WG 14 review in preparation for PDTS ballot

3
Changes (1) Page 7: added explanation of type structure changes Page 10: defined binary floating types for types _FloatN and _FloatNx Page 10: included types _DecimalNx in decimal floating types Pages 14-15: extended definitions of FLT_EVAL_METHOD and DEC_EVAL_METHOD to cover new types Pages 17-18: extended specification of conversions between integer and floating to cover new types

4
Changes (2) Pages 19-21: extended specification of operation constraints to cover new types Pages 22-23: added definitions for _t types corresponding to new interchange types Pages 26-27: enhanced specification of rounding mode controls to cover new types Pages 36-37: enhanced specification of frexp, ldexp, logb, scalbn, and scalbln to cover new types Corrections and clarifications

5
Type structure additions interchange floating types: _FloatN, _DecimalN extended floating types: _FloatNx, _DecimalNx real floating types standard floating types: float, double, long double binary floating types: _FloatN, _FloatNx decimal floating types: _DecimalN, _DecimalNx complex types float _Complex, double _Complex, long double _Complex _FloatN _Complex, _FloatNx _Complex Imaginary types float _Imaginary, double _Imaginary, long double _Imaginary _FloatN _Imaginary, _FloatNx _Imaginary

6
Type structure unchanged floating types real floating types complex types imaginary types real types integer types real floating types arithmetic types integer types floating types

7
Background slides …

8
TS organization Conformance to Part 3 requires conformance to Part 1 or Part 2 (or both) Specification is cumulative: C11 (+ TC 1) + Part 1 + Part 2 + Part 3 Changes in Part 3 are applied to C11 + Part 1 + Part 2 Part 3 decimal specification generalizes Part 2, so decimal floating types include all _DecimalN and _DecimalNx types Identifiers controlled by WANT macros listed in header clauses

9
Interchange formats IEC 60559-2011 introduced a "tower" of interchange formats Arbitrarily large widths (32x) Precision and range determined by width binary16, for GPU data etc. For exchange of FP data May or may not be arithmetic

10
Extended formats IEC 60559-2011 specifies extended formats that extend its basic formats (binary32|64|128 and decimal64|128) Have at least a specified precision and range For explicit wide evaluation Not for data exchange

11
IEC 60559 format support IEC 60559 formats: Interchange formats – Arithmetic – Non-arithmetic Extended formats Extendable formats Arithmetic interchange and extended formats fully supported as floating types Non-arithmetic interchange formats supported without additional types Extendable formats not covered

12
Non-arithmetic interchange formats Supported as encodings, not types Encodings stored in unsigned char arrays Required conversion operations provided by library functions Arithmetic interchange formats are supported as encodings and as types

13
Types are distinct and not compatible Requires interchange and extended floating types whose formats must already be supported because of conformance to Part 1 or 2 Requires support for binary16 format, at least as an encoding (if Part 1 is supported) Allows support for other interchange floating types and encodings Requires complex (and imaginary) types for supported binary interchange and extended floating types Requirements

14
Example 1 Assume – Part 1 conformance – long double has common IEEE 80-bit extended format And complex (and imaginary) types for all of above Required binary encoding widths: 16, 32, 64 Required new typeWidth _Float3232 _Float6464 _Float32x64 or 80 _Float64x80

15
Example 2 Assume – Part 1 conformance – long double has IEEE binary128 format And complex (and imaginary) types for all of above Required binary encoding widths: 16, 32, 64, 128 Required new typeWidth _Float3232 _Float6464 _Float128128 _Float32x64 or 128 _Float64x128

16
Example 3 Assume – Part 2 conformance Required decimal encoding widths: 32, 64, 128 Required typeWidth _Decimal3232 _Decimal6464 _Decimal128128 _Decimal64x128

17
For all supported interchange floating types … Encode – type-to-encoding (same format) Decode – encoding-to-type (same format) For all supported IEC 60559 encodings … Encoding-to-encoding conversions String-to-encoding conversions String-from-encoding conversions Each decimal type and encoding requires two sets of encoding functions, one for each decimal encoding scheme Encoding functions

18
Example 4 Assume – Part 1 conformance – long double has common IEEE 80-bit extended format – binary16 supported only as an encoding To convert binary16 encoding stored in unsigned char e16[2]; to _Float32 f32; use unsigned char e32[4]; f32encf16(e32, e16); decodef32(&f32, e32);

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google