autoconf: Clarify documentation of number format

https://github.com/libsdl-org/autoconf/commit/cbec82b65f6fb8f0092c908abaa05bd9aa300571

From cbec82b65f6fb8f0092c908abaa05bd9aa300571 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[EMAIL REDACTED]>
Date: Sat, 12 Feb 2022 14:47:52 -0800
Subject: [PATCH] Clarify documentation of number format

Problem reported by Mike Frysinger in:
https://lists.gnu.org/r/autoconf-patches/2022-02/msg00007.html
---
 doc/autoconf.texi   | 36 +++++++++++++++++++++++++-----------
 lib/m4sugar/m4sh.m4 | 16 ++++++----------
 2 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 49ee61cd..f5caa71d 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -12974,8 +12974,7 @@ m4_apply([m4_join], [[|], [1], [2]])
 
 @defmac m4_count (@var{arg}, @dots{})
 @msindex{count}
-This macro returns the decimal count of the number of arguments it was
-passed.
+This macro returns the number of arguments it was passed.
 @end defmac
 
 @defmac m4_curry (@var{macro}, @var{arg}@dots{})
@@ -13474,8 +13473,19 @@ respectively.
 @subsection Arithmetic computation in M4
 
 The following macros facilitate integer arithmetic operations.
+
 Where a parameter is documented as taking an arithmetic expression, you
 can use anything that can be parsed by @code{m4_eval}.
+Any other numeric parameter should consist of an optional sign followed
+by one or more decimal digits; it is treated as a decimal integer.
+
+Macros that expand to a number do so as either @samp{0}, or an optional
+@samp{-} followed by a nonzero decimal digit followed by zero or more
+decimal digits.
+
+Due to @command{m4} limitations, arithmetic expressions and numeric
+parameters should use only numbers that fit into a 32-bit signed
+integer.
 
 @defmac m4_cmp (@var{expr-1}, @var{expr-2})
 @msindex{cmp}
@@ -13512,13 +13522,13 @@ m4_list_cmp([1],          [1, 2])
 
 @defmac m4_max (@var{arg}, @dots{})
 @msindex{max}
-This macro was introduced in Autoconf 2.62.  Expand to the decimal value
+This macro was introduced in Autoconf 2.62.  Expand to the value
 of the maximum arithmetic expression among all the arguments.
 @end defmac
 
 @defmac m4_min (@var{arg}, @dots{})
 @msindex{min}
-This macro was introduced in Autoconf 2.62.  Expand to the decimal value
+This macro was introduced in Autoconf 2.62.  Expand to the value
 of the minimum arithmetic expression among all the arguments.
 @end defmac
 
@@ -14329,11 +14339,15 @@ assigning the result as the contents of the polymorphic shell variable
 @var{var}.  The code takes advantage of shells that provide @samp{$(())}
 for fewer forks, but uses @command{expr} as a fallback.  Therefore, the
 syntax for a valid @var{expression} is rather limited: all operators
-must occur as separate shell arguments and with proper quoting, there is
-no portable equality operator, all variables containing numeric values
-must be expanded prior to the computation, all numeric values must be
-provided in decimal without leading zeroes, and the first shell argument
-should not be a negative number.  In the following example, this snippet
+must occur as separate shell arguments and with proper quoting;
+the only operators supported are @samp{*}, @samp{/}, @samp{%}, binary
+@samp{+}, binary @samp{-}, @samp{>}, @samp{>=}, @samp{<}, @samp{<=},
+@samp{!=}, @samp{&}, and @samp{|};
+all variables containing numbers must be expanded prior to the computation;
+the first shell argument must not start with @samp{-};
+and each number must be an optional @samp{-} followed by one or more
+decimal digits, where the first digit is nonzero if there is more than
+one digit.  In the following example, this snippet
 will print @samp{(2+3)*4 == 20}.
 
 @example
@@ -16942,7 +16956,7 @@ When it is available, using arithmetic expansion provides a noticeable
 speedup in script execution; but testing for support requires
 @command{eval} to avoid syntax errors.  The following construct is used
 by @code{AS_VAR_ARITH} to provide arithmetic computation when all
-arguments are provided in decimal and without a leading zero, and all
+arguments are decimal integers without leading zeros, and all
 operators are properly quoted and appear as distinct arguments:
 
 @example
@@ -19821,7 +19835,7 @@ XSI options are those in @option{-bcdox}.  The BSD
 @command{hexdump} program can be used instead.
 
 In some versions of some operating systems derived from Solaris 11,
-@command{od} prints decimal byte values padded with zeroes rather than
+@command{od} prints decimal byte values padded with zeros rather than
 with spaces:
 
 @smallexample
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index e0d50431..6909012e 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -1498,8 +1498,8 @@ fi])
 # AS_FUNCTION_DESCRIBE(NAME, [ARGS], DESCRIPTION, [WRAP-COLUMN = 79])
 # -------------------------------------------------------------------
 # Output a shell comment describing NAME and its arguments ARGS, then
-# a separator line, then the DESCRIPTION wrapped at a decimal
-# WRAP-COLUMN.  The output resembles:
+# a separator line, then the DESCRIPTION wrapped at WRAP-COLUMN.
+# The output resembles:
 #  # NAME ARGS
 #  # ---------
 #  # Wrapped DESCRIPTION text
@@ -1518,9 +1518,9 @@ m4_text_wrap([$3], [@%:@ ], [], [$4])])
 #
 # Format a help string so that it looks pretty when the user executes
 # "script --help".  This macro takes up to four arguments, a
-# "left hand side" (LHS), a "right hand side" (RHS), a decimal
+# "left hand side" (LHS), a "right hand side" (RHS),
 # INDENT-COLUMN which is the column where wrapped lines should begin
-# (the default of 26 is recommended), and a decimal WRAP-COLUMN which is
+# (the default of 26 is recommended), and WRAP-COLUMN which is
 # the column where lines should wrap (the default of 79 is recommended).
 # LHS is expanded, RHS is not.
 #
@@ -2030,12 +2030,8 @@ m4_define([_AS_VAR_ARITH_WORKS],
 # Perform the arithmetic evaluation of the arguments in EXPR, and set
 # contents of the polymorphic shell variable VAR to the result, taking
 # advantage of any shell optimizations that perform arithmetic without
-# forks.  Note that numbers occurring within EXPR must be written in
-# decimal, and without leading zeroes; variables containing numbers
-# must be expanded prior to arithmetic evaluation; the first argument
-# must not be a negative number; there is no portable equality
-# operator; and operators must be given as separate arguments and
-# properly quoted.
+# forks.  Because EXPR might be evaluated via either $((...)) or the
+# 'expr' command, EXPR's syntax is limited; see the Autoconf manual.
 m4_defun_init([AS_VAR_ARITH],
 [_AS_DETECT_SUGGESTED([_AS_VAR_ARITH_WORKS])]dnl
 [AS_REQUIRE([_AS_VAR_ARITH_PREPARE], [], [M4SH-INIT-FN])],