Open
Description
Clang-format already has an IntegerLiteralSeparator
option that adds separators to integer literals. When I started using it, it confused me there was no alternative for floating point literals.
It would be great to either:
- Add a new option called
FloatingPointLiteralSeparator
, which would do the same as its integer alternative, only for floating point literals. - Expand the existing
IntegerLiteralSeparator
to apply the formatting to floating point literals.
I was imagining something like:
# .clang-format
FloatingPointLiteralSeparator:
Decimal: 3
DecimalMinDigits: 5
Hex: 4
HexMinDigits: 5
The resulting format could look like this:
// Before
double decimal = 12345678.12345678e-50;
double hexa = 0x1234567.89abcdfp-100;
// After
double decimal = 12'345'678.123'456'78e-50;
double hexa = 0x123'4567.89ab'cdfp-100;