[all-commits] [llvm/llvm-project] f92c73: [libc++][format] Fixes floating-point formatting.

mordante via All-commits all-commits at lists.llvm.org
Wed Aug 31 10:26:11 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f92c733cc26d40fada0e89005d38d3f6f0bf413a
      https://github.com/llvm/llvm-project/commit/f92c733cc26d40fada0e89005d38d3f6f0bf413a
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    M libcxx/include/__format/formatter_floating_point.h
    M libcxx/include/__format/parser_std_format_spec.h
    M libcxx/test/std/utilities/format/format.functions/format_tests.h

  Log Message:
  -----------
  [libc++][format] Fixes floating-point formatting.

Formatting the alternate form for the general categories should keep the
trailing zeros. This was reported by @fsb4000 in D131336.

The default format uses general formatting but this should not keep the
trailing zeros so the default format is not passed to the formatter.

While testing I found an off by one error; finding the exponent character
`e` in 1e+03 will start at after the `1` so a size of `4` can contain an
exponent.

Reviewed By: fsb4000, ldionne, #libc

Differential Revision: https://reviews.llvm.org/D131417




More information about the All-commits mailing list