<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/131510>131510</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Feature Request: FloatingPointLiteralSeparator
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
xhrnca00
</td>
</tr>
</table>
<pre>
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:
1. Add a new option called `FloatingPointLiteralSeparator`, which would do the same as its integer alternative, only for floating point literals.
2. Expand the existing `IntegerLiteralSeparator` to apply the formatting to floating point literals.
I was imagining something like:
```yaml
# .clang-format
FloatingPointLiteralSeparator:
Decimal: 3
DecimalMinDigits: 5
Hex: 4
HexMinDigits: 5
```
The resulting format could look like this:
```C
// 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;
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEVNFu6zYM_Rrlhaghy3acPvghbRaswAYM24A90xZta1e2PIluk78fpLi3vXe7LRAgonUODw9JCEMww0zUiOpBVKcdrjw631xGP3co5a51-to8WpyHu975CRnQekJ9hRED4AxiL59mpoH8L4bJo_2DFvTIzou9BLewcTPwGIlaBwivtwHYgbkxwd6oIYO_RprhCQKjZ9KwBjMPYFioRzAMnZv7NZCGiYBH8gQvGGB2gJbJz8jmmaB3HnrrkCN1cWbmt_xCHoU8PjG8uNVqaAkGT8ixFjIxoygiIM_gqDUgzPTy6qFDa0lHv-ct-W8x9_-4jsW-jKYbNxXtYrEQcCLAAIbDV-Pv6o4sN9vrZ_WrDH66LDjrlJQuJiTgx3NgB7gs9po4t0EmFrvPWpU6bCYczBxBwU3EYzxZ84Vu3YqW0--Kk42xKiDr3u2MkMePe5bSAJyoMxNaURyhiB-2-Fczn8xgOMSLKiF_pksMytfgP5CvNQl5_HMk8BRWm2xua9yl0VjnviQnwKMJ39l5TF7OQp3hgXrnScijdmtrCfStMhDFCXJVlNW-PmSvB7qrpCge3tAjXTBB5WXDZId7bDvdL3e53LBvYseeyf9IS6i6KCuh6k1RqLqs9kLVn-rekDdpoerv1N_1S8jjTjeFvi_ucUdNXpcqV0oWajc2fduqgyyl1FXX97qWLZV06Ess86LFrt-ZRklVySLf57Ksc5Ud-uq-qGUl87boiFCUkiY0NrP2ecqcH3YmhJWavMirXO4stmRDeo6U-maJlIoPlG8i765dhyBKaU3g8JaJDdv0lH1DrE5wJuTVE_xO_6wUOG7Jhxu5W71tRuYl7UQay2B4XNusc5NQ56i4_d0t3v1NHQt1TkaCUOfNy3Oj_g0AAP__B7e6AQ">