[all-commits] [llvm/llvm-project] 5bd34e: [libc] Fix Off By One Errors In Printf Long Double...

michaelrj-google via All-commits all-commits at lists.llvm.org
Thu Sep 21 11:43:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5bd34e0a551e379d99004e5f34b932eb32569caa
      https://github.com/llvm/llvm-project/commit/5bd34e0a551e379d99004e5f34b932eb32569caa
  Author: michaelrj-google <71531609+michaelrj-google at users.noreply.github.com>
  Date:   2023-09-21 (Thu, 21 Sep 2023)

  Changed paths:
    M libc/src/__support/float_to_string.h
    M libc/src/__support/ryu_long_double_constants.h
    M libc/test/src/stdio/sprintf_test.cpp
    M libc/utils/mathtools/ryu_tablegen.py

  Log Message:
  -----------
  [libc] Fix Off By One Errors In Printf Long Double (#66957)

Two major off-by-one errors are fixed in this patch. The first is in
float_to_string.h with length_for_num, which wasn't accounting for the
implicit leading bit when calculating the length of a number, causing
a missing digit on 80 bit float max. The other off-by-one is the
ryu_long_double_constants.h (a.k.a the Mega Table) not having any
entries for the last POW10_OFFSET in POW10_SPLIT. This was also found on
80 bit float max. Finally, the integer calculation mode was using a
slightly too short integer, again on 80 bit float max, not accounting
for the mantissa width. All of these are fixed in this patch.




More information about the All-commits mailing list