- /* First, if FMT has more decimal places than allowed, attempt
- to increase FMT's width until that number of decimal places
- can be achieved. */
- if (fmt->d > fmt_max_decimals (fmt->type, fmt->w, for_input))
+ /* Round width to step. */
+ step = fmt_step_width (fmt->type);
+ fmt->w = ROUND_DOWN (fmt->w, step);
+
+ /* If FMT has more decimal places than allowed, attempt to increase FMT's
+ width until that number of decimal places can be achieved. */
+ if (fmt->d > fmt_max_decimals (fmt->type, fmt->w, for_input)
+ && fmt_takes_decimals (fmt->type))