4 ms·
What number is this? 100000000000000
by theseoafs 11y ago
What number is this?
100000000000000
- gamegoblin 11y agoI actually really like the Java way of doing this: 100_000_000_000_000
- JoachimSchipper 11y agoThat works, but even in C I'd simply write this as (100 * 1000 * 1000 * 1000 * 1000), which is perfectly clear and no slower. (Or, rather, as ((uint64_t)100 * 1000 * 1000 * 1000 * 1000), but you'll need to do something to prevent overflow in most languages, anyway.)
- tzs 11y agoThat also works in Perl, Ruby, C#, ADA, D, and Julia. According to Wikipedia [1] underscore was proposed for C++ but rejected because it conflicts with user-defined literals. Is there any reason they could not have used space? Offhand, I can't think of anyplace where a space in a literal number would not currently be illegal, so adding that as a separator should not introduce any problems, but C++ has grown massively in complexity since I last seriously used it so I could easily have overlooked something. [1] https://en.m.wikipedia.org/wiki/Integer_literal#Digit_separators https://en.m.wikipedia.org/wiki/Integer_literal#Digit_separa...
- pklausler 11y agoA space could not be allowed in numeric values in runtime input (fscanf, <<).