[Cfp-interest] Three round nearest modes and FLT_ROUNDS
Fred J. Tydeman
tydeman at tybor.com
Tue Oct 23 08:46:54 PDT 2018
The current draft of 754 has three different rounding modes for midway
ties to even (for binary and decimal)
ties away from zero (for decimal; optional for binary)
ties toward zero (for augmented operations; not required for any other operations)
WG14 paper N2124 is adding FE_TONEARESTFROMZERO to C
Should we be adding something like:
FE_TONEARESTTOZERO
FE_DEC_TONEARESTTOZERO
to C?
Given that there could be three different meanings for Round to Nearest,
what should FLT_ROUNDS be? Should FLT_ROUNDS have a value
for each of the possible FE_* rounding macros?
C has (in 7.6.1)
216) Even though the rounding direction macros might expand to
constants corresponding to the values of FLT_ROUNDS, they
are not required to do so.
F.2 has:
The value of FLT_ROUNDS applies to all IEC 60559 types
supported by the implementation, but need not apply to non-IEC 60559 types.
F.3 has:
The fegetround and fesetround functions in <fenv.h> provide the facility to select among
the IEC 60559 directed rounding modes represented by the rounding direction macros in
<fenv.h> (FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO)
and the values 0, 1 , 2, and 3 of FLT_ROUNDS are the IEC 60559 directed rounding modes.
---
Fred J. Tydeman Tydeman Consulting
tydeman at tybor.com Testing, numerics, programming
+1 (702) 608-6093 Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.
More information about the Cfp-interest
mailing list