<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Converging. Please see comments below.</div><div class=""><br class=""></div><div class="">- Jim Thomas</div><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 26, 2020, at 1:17 PM, Fred J. Tydeman <<a href="mailto:tydeman@tybor.com" class="">tydeman@tybor.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">On Thu, 25 Jun 2020 17:02:29 -0700 Jim Thomas wrote:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class="">Here's a cut at a Description for fromfp and ufromfp functions with floating return types<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">I took your words as a starting point. Attached is my latest version.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">In my web browser, the text being removed is red and the text being added is green.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">---</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Fred J. Tydeman Tydeman Consulting</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="mailto:tydeman@tybor.com" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">tydeman@tybor.com</a><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""><span class="Apple-converted-space"> </span> Testing, numerics, programming</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">+1 (702) 608-6093 Vice-chair of PL22.11 (ANSI "C")</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Sample C99+FPCE tests:<span class="Apple-converted-space"> </span></span><a href="http://www.tybor.com/" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://www.tybor.com</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Savers sleep well, investors eat well, spenders work forever.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class=""><b class="">Submitter:</b>Fred J. Tydeman<br class=""><b class="">Submission Date:</b><span class="Apple-converted-space"> </span>2020-mm-dd<br class=""><b class="">Document:</b><span class="Apple-converted-space"> </span>WG14 N2xxx<br class=""><b class="">Title:</b><span class="Apple-converted-space"> </span>N2xxx: intmax_t and math functions<br class=""><b class="">Reference Documents:</b><span class="Apple-converted-space"> </span>N2478, N2525</p><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Summary</p><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Due to issues raised by the WG14 committee with [u]intmax_t, several of the CFP related functions ([u]fromfp[x], compoundn, pown, rootn) should be changed to not use [u]intmax_t.</span><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">The WG14 consideration of removing [u]intmax_t, sparked the CFP discussion. We concluded that changing the interfaces to not use [u]intmax_t would be better anyway (even if [u]intmax_t were not removed). Introducing type [u]intmax_t into an expression via a function return type could have unpredictable negative performance implications.</p><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">In general, replace [u]intmax_t with the floating type used as the parameter.</p><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Change</p><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">7.12.9.10 The fromfp and ufromfp functions</blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Synopsis</blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><pre class=""><code class="">
1 #include <stdint.h>
#include <math.h>
intmax_t fromfp(double x, int round, unsigned int width);
intmax_t fromfpf(float x, int round, unsigned int width);
intmax_t fromfpl(long double x, int round, unsigned int width);
uintmax_t ufromfp(double x, int round, unsigned int width);
uintmax_t ufromfpf(float x, int round, unsigned int width);
uintmax_t ufromfpl(long double x, int round, unsigned int width);
#ifdef __STDC_IEC_60559_DFP__
intmax_t fromfpd32(_Decimal32 x, int round, unsigned int width);
intmax_t fromfpd64(_Decimal64 x, int round, unsigned int width);
intmax_t fromfpd128(_Decimal128 x, int round, unsigned int width);
uintmax_t ufromfpd32(_Decimal32 x, int round, unsigned int width);
uintmax_t ufromfpd64(_Decimal64 x, int round, unsigned int width);
uintmax_t ufromfpd128(_Decimal128 x, int round, unsigned int width);
#endif
</code>
</pre></blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Description</blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><p class="">2 The<span class="Apple-converted-space"> </span><b class="">fromfp</b><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><b class="">ufromfp</b><span class="Apple-converted-space"> </span>functions round x, using the math rounding direction indicated by<span class="Apple-converted-space"> </span><b class="">round</b>, to a signed or unsigned integer, respectively, of<span class="Apple-converted-space"> </span><b class="">width</b><span class="Apple-converted-space"> </span>bits, and return the result value in the integer type designated by<span class="Apple-converted-space"> </span><b class="">intmax_t</b><span class="Apple-converted-space"> </span>or<span class="Apple-converted-space"> </span><b class="">uintmax_t</b>, respectively. If the value of the<span class="Apple-converted-space"> </span><b class="">round</b><span class="Apple-converted-space"> </span>argument is not equal to the value of a math rounding direction macro, the direction of rounding is unspecified. If the value of<span class="Apple-converted-space"> </span><b class="">width</b><span class="Apple-converted-space"> </span>exceeds the width of the function type, the rounding is to the full width of the function type. The<span class="Apple-converted-space"> </span><b class="">fromfp</b><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><b class="">ufromfp</b><span class="Apple-converted-space"> </span>functions do not raise the "inexact" floating-point exception. If x is infinite or NaN or rounds to an integral value that is outside the range of any supported integer type of the specified width, or if width is zero, the functions return an unspecified value and a domain error occurs.</p></blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">3 Returns</blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><p class="">The<span class="Apple-converted-space"> </span><b class="">fromfp</b><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><b class="">ufromfp</b><span class="Apple-converted-space"> </span>functions return the rounded integer value.</p></blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><p class="">4 EXAMPLE Upward rounding of double x to type int, without raising the "inexact" floating-point exception, is achieved by</p><pre class=""><code class="">
(int)fromfp(x, FP_INT_UPWARD, INT_WIDTH)
</code>
</pre></blockquote><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">to</p><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">7.12.9.10 The fromfp and ufromfp functions</blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Synopsis</blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><pre class=""><code class="">
1 #include <stdint.h>
#include <math.h>
<del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">intmax_t</del> <ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">double</ins> fromfp(double x, int round, unsigned int width);
<del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">intmax_t</del> <ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">float</ins> fromfpf(float x, int round, unsigned int width);
<del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">intmax_t</del> <ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">long double</ins> fromfpl(long double x, int round, unsigned int width);
<del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">uintmax_t</del> <ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">double</ins> ufromfp(double x, int round, unsigned int width);
<del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">uintmax_t</del> <ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">float</ins> ufromfpf(float x, int round, unsigned int width);
<del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">uintmax_t</del> <ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">long double</ins> ufromfpl(long double x, int round, unsigned int width);
#ifdef __STDC_IEC_60559_DFP__
<del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">intmax_t</del> <ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">_Decimal32</ins> fromfpd32(_Decimal32 x, int round, unsigned int width);
<del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">intmax_t</del> <ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">_Decimal64</ins> fromfpd64(_Decimal64 x, int round, unsigned int width);
<del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">intmax_t</del> <ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">_Decimal128</ins> fromfpd128(_Decimal128 x, int round, unsigned int width);
<del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">uintmax_t</del> <ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">_Decimal32</ins> ufromfpd32(_Decimal32 x, int round, unsigned int width);
<del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">uintmax_t</del> <ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">_Decimal64</ins> ufromfpd64(_Decimal64 x, int round, unsigned int width);
<del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">uintmax_t</del> <ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">_Decimal128</ins> ufromfpd128(_Decimal128 x, int round, unsigned int width);
#endif
</code>
</pre></blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Description</blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><p class="">2 The<span class="Apple-converted-space"> </span><b class="">fromfp</b><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><b class="">ufromfp</b><span class="Apple-converted-space"> </span>functions round x, using the math rounding direction indicated by<span class="Apple-converted-space"> </span><b class="">round</b>, to a signed or unsigned integer, respectively.<span class="Apple-converted-space"> </span><del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">, of<span class="Apple-converted-space"> </span><b class="">width</b><span class="Apple-converted-space"> </span>bits, and return the result value in the integer type designated by<span class="Apple-converted-space"> </span><b class="">intmax_t</b><span class="Apple-converted-space"> </span>or<span class="Apple-converted-space"> </span><b class="">uintmax_t</b>, respectively.</del><span class="Apple-converted-space"> </span><ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">If<span class="Apple-converted-space"> </span><b class="">width</b><span class="Apple-converted-space"> </span>is nonzero and the resulting integer is within the range</ins></p><pre class=""><ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class=""> [-2**(width-1), 2**(width-1) - 1], for signed
[0, 2**width - 1], for unsigned
</ins>
</pre><p class=""><ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">the functions return the integer value (represented in floating type). Otherwise, if<span class="Apple-converted-space"> </span><b class="">width</b><span class="Apple-converted-space"> </span>is zero or<span class="Apple-converted-space"> </span><b class="">x</b><span class="Apple-converted-space"> </span>does not round to an integer within the range, the functions return a NaN (if available), else an infinity (if available), else a HUGE_VAL, of the type of the<span class="Apple-converted-space"> </span><b class="">x</b>argument, and a domain error occurs.</ins><span class="Apple-converted-space"> </span>If the value of the<span class="Apple-converted-space"> </span><b class="">round</b><span class="Apple-converted-space"> </span>argument is not equal to the value of a math rounding direction macro<span class="Apple-converted-space"> </span><ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">(7.12)</ins>, the direction of rounding is unspecified. If the value of<span class="Apple-converted-space"> </span><b class="">width</b><span class="Apple-converted-space"> </span>exceeds the width of the function type, the rounding is to the full width of the function type. The<span class="Apple-converted-space"> </span><b class="">fromfp</b><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><b class="">ufromfp</b><span class="Apple-converted-space"> </span>functions do not raise the "inexact" floating-point exception.<span class="Apple-converted-space"> </span><del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">If x is infinite or NaN or rounds to an integral value that is outside the range of any supported integer type of the specified width, or if width is zero, the functions return an unspecified value and a domain error occurs.</del></p></blockquote></div></blockquote><div>The sentence "If the value of width exceeds the width of the function type, the rounding is to the full width of the function type.” doesn’t add anything. It can be removed.</div><div><br class=""></div><div>Consider changing "else an infinity (if available), else a HUGE_VAL, of the type of the xargument” to “else the value of x”.</div><blockquote type="cite" class=""><div class=""><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">3 Returns</blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><p class="">The<span class="Apple-converted-space"> </span><b class="">fromfp</b><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><b class="">ufromfp</b><span class="Apple-converted-space"> </span>functions return the rounded integer value.</p></blockquote><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><p class="">4 EXAMPLE Upward rounding of double x to type int, without raising the "inexact" floating-point exception<ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">; unsigned wrapping is not performed in the second call</ins>, is achieved by</p><pre class=""><code class="">
(int)fromfp(x, FP_INT_UPWARD, INT_WIDTH)
<ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">ufromfp(-3.0, FP_INT_UPWARD, UINT_WIDTH) /* domain error */</ins>
</code>
</pre></blockquote></div></blockquote>If we want the example about unsigned wrapping, it should be a separate example. Maybe change “unsigned wrapping” to “unsigned integer wrapping”.<br class=""><blockquote type="cite" class=""><div class=""><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Also, in F.10.6.10:</p><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Change:</p><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><p class="">1 The fromfp and ufromfp functions raise the "invalid" floating-point exception and return an unspecified value if the floating-point argument x is infinite or NaN or rounds to an integral value that is outside the range of any supported integer type of the specified width.</p></blockquote><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">to:</p><blockquote style="display: block; font-family: "Times New Roman"; background-color: lightgray; margin: 1em 40px; caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><p class="">1 The fromfp and ufromfp functions raise the "invalid" floating-point exception and return<span class="Apple-converted-space"> </span><del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">an unspecified value</del><span class="Apple-converted-space"> </span><ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">a NaN</ins><span class="Apple-converted-space"> </span>if the<span class="Apple-converted-space"> </span><ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">argument<span class="Apple-converted-space"> </span><b class="">width</b><span class="Apple-converted-space"> </span>is zero or if the</ins><span class="Apple-converted-space"> </span>floating-point argument x is infinite or NaN or rounds to an integer value that is outside the range<span class="Apple-converted-space"> </span><del style="font-weight: bold; background-color: rgb(255, 160, 160);" class="">of any supported integer type of the specified width</del><span class="Apple-converted-space"> </span><ins style="font-weight: bold; background-color: rgb(160, 255, 160);" class="">determined by the argument width (see 7.12.9.2)</ins>.</p></blockquote></div></blockquote></div><br class=""></body></html>