Add Ronna (10^27), and Quetta (10^30) SI prefixes.

As voted for in Nov 2022 by the BIPM:
https://www.bipm.org/en/cgpm-2022/resolution-3

Sync with gnulib 0ad3ea4951f77835d02180021589f3a849d885f2.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2022-12-04 12:05:33 +03:00
parent 6d639ce942
commit 3ad5f5502f
2 changed files with 14 additions and 2 deletions

View File

@ -147,6 +147,8 @@ xstrtoumax (const char *s, char **ptr, int base, uintmax_t * val, const char *va
case 'M':
case 'm':
case 'P':
case 'Q':
case 'R':
case 'T':
case 't':
case 'Y':
@ -221,6 +223,14 @@ xstrtoumax (const char *s, char **ptr, int base, uintmax_t * val, const char *va
overflow = bkm_scale_by_power (&tmp, base, 5);
break;
case 'Q': /* quetta or 2**100 */
overflow = bkm_scale_by_power (&tmp, base, 10);
break;
case 'R': /* ronna or 2**90 */
overflow = bkm_scale_by_power (&tmp, base, 9);
break;
case 'T': /* tera or tebi */
case 't': /* 't' is undocumented; for compatibility only */
overflow = bkm_scale_by_power (&tmp, base, 4);

View File

@ -451,8 +451,10 @@ size_trunc_len (char *buffer, unsigned int len, uintmax_t size, int units, gbool
#endif
};
/* *INDENT-ON* */
static const char *const suffix[] = { "", "K", "M", "G", "T", "P", "E", "Z", "Y", NULL };
static const char *const suffix_lc[] = { "", "k", "m", "g", "t", "p", "e", "z", "y", NULL };
static const char *const suffix[] =
{ "", "K", "M", "G", "T", "P", "E", "Z", "Y", "R", "Q", NULL };
static const char *const suffix_lc[] =
{ "", "k", "m", "g", "t", "p", "e", "z", "y", "r", "q", NULL };
const char *const *sfx = use_si ? suffix_lc : suffix;
int j = 0;