[Cfp-interest] Three round nearest modes and FLT_ROUNDS
Jim Thomas
jaswthomas at sbcglobal.net
Tue Oct 23 12:06:37 PDT 2018
My understanding is that 754-2019 does not intend for roundTiesToZero to be a new user selectable rounding direction. C 7.31.4 already reserves the names with an FE_ prefix, so the names would be available if a future revision of 754 added a user selectable rounding direction. It wouldn’t be appropriate for C to get in front of 754 on this.
- Jim Thomas
> On Oct 23, 2018, at 8:46 AM, Fred J. Tydeman <tydeman at tybor.com> wrote:
>
> 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.
>
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest
More information about the Cfp-interest
mailing list