mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 12:54:00 -05:00
Long numbers are sometimes hard to read in the numeric tooltip. To improve readability, this PR adds language-specific digit separators to the numeric tooltip. Decimal numbers are grouped into chunks of three digits while hexadecimal numbers are grouped into chunks of length four. The digit separator is language-specific and chosen so that the number is a valid token in the source language. [Examples](https://godbolt.org/z/s86cMbjeK): * for C++, hovering the number `8583909746840200552` shows this tooltip: `8'583'909'746'840'200'552 = 0x7720'2C6F'6C6C'6568 = 6.5188685003648344e+265` * for Python, hovering the number `-12345678` shows this tooltip: `-123_456_789 = 0xFFFF_FFFF_F8A4_32EB = -2.66427945e+34f` For languages that don’t have a `digitSeparator` set, the tooltip is not changed.