[Cfp-interest 2679] GB 287
Fred J. Tydeman
tydeman at tybor.com
Wed Feb 1 11:03:06 PST 2023
Thoughts on GB 287
IEEE-754-2019 has:
5.4.2 Conversion operations for floating-point formats and decimal
character sequences
Implementations shall provide the following formatOf conversion
operations from all supported floating-point formats to all supported
floating-point formats, as well as conversions to and from decimal
character sequences.
So, to convert from non-arithmetic binary128 to arithmetic decimal128
in C requires one of:
1) d128_from_b128()
2) d128 <-(rnd) hex string <-(exact) b128 [w/ 29 hex digits]
3) d128 <-(rnd) decimal string <-(exact) b128 [w/ 16496 digits]
4) d128 <-(exact) decimal string <-(rnd) b128 [w/ 34 digits]
Option 1 would require many similar functions.
Or, one function that takes the largest binary format
and the kind of decimal FP format and
returns a union of all the decimal formats.
Option 2 is what is in C23.
Option 3 requires many more digits than C23 requires.
Option 4 has double rounding for subnormal decimal numbers.
Unless the conversion to string is told the decimal FP format.
---
Fred J. Tydeman Tydeman Consulting
tydeman at tybor.com Testing, numerics, programming
+1 (702) 608-6093 Vice-chair of INCITS/C (ANSI "C")
Sample C17+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.
More information about the Cfp-interest
mailing list