]> Savannah Git Hosting - gnulib.git/commitdiff
add new ronna and quetta SI prefixes
authorPádraig Brady <P@draigBrady.com>
Tue, 29 Nov 2022 15:05:07 +0000 (15:05 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 29 Nov 2022 17:36:39 +0000 (17:36 +0000)
As voted for in Nov 2022 by the BIPM:
https://www.bipm.org/en/cgpm-2022/resolution-3

* lib/human.c: Add Ronna (10^27), and Quetta (10^30) to the prefix list.
* lib/xstrtol.c (__xstrtol): Likewise.

ChangeLog
lib/human.c
lib/xstrtol.c

index e1b00bf5c90ce241978fbda4c73f8ddd9f0241f8..90664d16a58241313705e3441574333aa18f2c2b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-11-29  Pádraig Brady  <P@draigBrady.com>
+
+       add new ronna and quetta SI prefixes
+       As voted for in Nov 2022 by the BIPM:
+       https://www.bipm.org/en/cgpm-2022/resolution-3
+
+       * lib/human.c: Add Ronna (10^27), and Quetta (10^30) to the prefix list.
+       * lib/xstrtol.c (__xstrtol): Likewise.
+
 2022-11-29  Bruno Haible  <bruno@clisp.org>
 
        Update users.txt.
index df537271bd979fca67eece104cab59bbf71eaedf..0ce23a6b1d020192f133db37cf73a9ea82bede91 100644 (file)
@@ -43,7 +43,9 @@ static const char power_letter[] =
   'P',  /* peta or pebi */
   'E',  /* exa or exbi */
   'Z',  /* zetta or 2**70 */
-  'Y'   /* yotta or 2**80 */
+  'Y',  /* yotta or 2**80 */
+  'R',  /* ronna or 2**90 */
+  'Q'   /* quetta or 2**100 */
 };
 
 
index e0a692ff2c038588cb8c098d6663c541f52f8148..0c9910bbff8fb928c7b46bbf9bdff0f887b20434 100644 (file)
@@ -140,7 +140,7 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
       switch (**p)
         {
         case 'E': case 'G': case 'g': case 'k': case 'K': case 'M': case 'm':
-        case 'P': case 'T': case 't': case 'Y': case 'Z':
+        case 'P': case 'Q': case 'R': case 'T': case 't': case 'Y': case 'Z':
 
           /* The "valid suffix" '0' is a special flag meaning that
              an optional second suffix is allowed, which can change
@@ -205,6 +205,14 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
           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);