Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20261004222526.GA31895@brightrain.aerifal.cx>
Date: Sun, 4 Oct 2026 18:25:29 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: [PATCH] Localized radix point and numeric grouping (%'d/%'f) support

These patches are an extension of the locale project series. I'd been
thinking about radix character support as something that wasn't yet
settled beyond ensuring the locale source and binary formats would be
able to represent it, but it rather was decided back in:

https://www.openwall.com/lists/musl/2025/06/18/13

that the 1-bit selection between '.' and ',' would be offered. The
first 5 patches of the series implement this in steps:

- exposing the data from the locale for printf/scanf/strtod to use

- preparing ecvt (awful legacy function) to deal with printf possibly
  using ',' instead of '.'

- making printf emit the locale's radix character

- making scanf/strtod family accept the locale's radix character in
  addition to always accepting '.'

- making strtod_l family perform uselocale so the underlying calls to
  strtod family honor the requested locale_t


Numeric digit grouping ("thousands" separators) is a much less
controversial feature, since it's only activated by the "'" modifer
flag to printf decimal formats (d,i,u,f,g). The remaining 5 patches
implement this functionality and unify the grouping logic with
strfmon:

- exposing grouping rules from locale data

- implementing core grouping logic and hooking it up to byte-oriented
  printf family.

- extending grouping to wide printf by adapting the byte-oriented
  printf core to behave specially on wide-oriented streams.

- exposing the new grouping functions outside of printf.

- reworking strfmon to use the new grouping code to eliminate
  quadratic time cost in the original strfmon (from the locale
  overhaul patch series).


As before, the fairly large number of individual patches are because
these have been factored for easy review now and in the permanent
history when they are merged.



View attachment "0001-locale-make-radix-point-character-available-for-form.patch" of type "text/plain" (3163 bytes)

View attachment "0002-ecvt-handle-radix-point-from-sprintf-being-either-.-.patch" of type "text/plain" (760 bytes)

View attachment "0003-printf-honor-locale-specific-radix-point.patch" of type "text/plain" (2370 bytes)

View attachment "0004-scanf-strtod-honor-locale-specific-radix-point.patch" of type "text/plain" (2535 bytes)

View attachment "0005-strtod_l-family-honor-the-locale_t-argument.patch" of type "text/plain" (1457 bytes)

View attachment "0006-locale-provide-access-to-numeric-grouping-rules.patch" of type "text/plain" (1238 bytes)

View attachment "0007-printf-implement-numeric-grouping-flag.patch" of type "text/plain" (6720 bytes)

View attachment "0008-printf-add-numeric-grouping-for-wide-character-varia.patch" of type "text/plain" (4055 bytes)

View attachment "0009-move-the-digit-grouper-interface-to-locale_impl.h.patch" of type "text/plain" (1851 bytes)

View attachment "0010-strfmon-use-shared-digit-grouping-code-from-printf.patch" of type "text/plain" (3421 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.