1 / 18

Changes to TS 18661 Part 3 Interchange and extended types

Changes to TS 18661 Part 3 Interchange and extended types. WG 14 N1796 2014-04-07. Part 3 draft N1796. TS 18661 Part 3 is C support for new IEC 60559 formats N1796 updates N1758 discussed in C hicago Goal: show changes, consider for WG 14 review in preparation for PDTS ballot.

yagil
Download Presentation

Changes to TS 18661 Part 3 Interchange and extended types

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Changes to TS 18661 Part 3Interchange 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. Requirements • 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

  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

  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

  16. Example 3 Assume • Part 2 conformance Required decimal encoding widths: 32, 64, 128

  17. Encoding functions 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

  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);

More Related