This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Ping Re: Make strtod respect the rounding mode (bug 14518)
On 2012-09-11 14:25, Joseph S. Myers wrote:
> +/* Internal type for floating-point rounding modes. */
> +typedef enum
> +{
> + round_downward,
> + round_tonearest,
> + round_towardzero,
> + round_upward
> +} rounding_mode_t;
Is there a good reason why you're defining a new enumeration instead
of letting the arch-specific header either (1) include bits/fenv.h,
or (2) define some other names that are bit-compatible with what comes
out of the fpu?
I'm not a fan of cookie-cutter translations like this:
> + switch (fc & FE_TOWARDZERO)
> + {
> + case FE_DOWNWARD:
> + return round_downward;
> +
> + case FE_TONEAREST:
> + return round_tonearest;
> +
> + case FE_TOWARDZERO:
> + return round_towardzero;
> +
> + case FE_UPWARD:
> + return round_upward;
> +
> + default:
> + abort ();
> + }
The substance in strtod_l.c and the associated test looks good.
r~