bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH] add new ronna and quetta SI prefixes
@ 2022-11-29 16:13 Pádraig Brady
  2022-11-29 17:37 ` Bruno Haible
  0 siblings, 1 reply; 3+ messages in thread
From: Pádraig Brady @ 2022-11-29 16:13 UTC (permalink / raw
  To: bug-gnulib; +Cc: Pádraig Brady

As voted for in Nov 2022 but 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     |  9 +++++++++
 lib/human.c   |  4 +++-
 lib/xstrtol.c | 10 +++++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e1b00bf5c9..12887e3917 100644
--- 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 but 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.
diff --git a/lib/human.c b/lib/human.c
index df537271bd..0ce23a6b1d 100644
--- a/lib/human.c
+++ b/lib/human.c
@@ -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 */
 };
 
 
diff --git a/lib/xstrtol.c b/lib/xstrtol.c
index e0a692ff2c..0c9910bbff 100644
--- a/lib/xstrtol.c
+++ b/lib/xstrtol.c
@@ -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);
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] add new ronna and quetta SI prefixes
  2022-11-29 16:13 [PATCH] add new ronna and quetta SI prefixes Pádraig Brady
@ 2022-11-29 17:37 ` Bruno Haible
  2022-11-29 17:38   ` Pádraig Brady
  0 siblings, 1 reply; 3+ messages in thread
From: Bruno Haible @ 2022-11-29 17:37 UTC (permalink / raw
  To: bug-gnulib; +Cc: Pádraig Brady

The code looks good; thanks!

> As voted for in Nov 2022 but the BIPM:

What does 'but' mean here? Did you mean "by the BIPM"?

Bruno





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] add new ronna and quetta SI prefixes
  2022-11-29 17:37 ` Bruno Haible
@ 2022-11-29 17:38   ` Pádraig Brady
  0 siblings, 0 replies; 3+ messages in thread
From: Pádraig Brady @ 2022-11-29 17:38 UTC (permalink / raw
  To: Bruno Haible, bug-gnulib

On 29/11/2022 17:37, Bruno Haible wrote:
> The code looks good; thanks!
> 
>> As voted for in Nov 2022 but the BIPM:
> 
> What does 'but' mean here? Did you mean "by the BIPM"?

Right, had just fixed that locally :)

thanks,
Pádraig



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-29 17:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-29 16:13 [PATCH] add new ronna and quetta SI prefixes Pádraig Brady
2022-11-29 17:37 ` Bruno Haible
2022-11-29 17:38   ` Pádraig Brady

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).