bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: math operations with base#prefix


From: Victor Pasko
Subject: Re: math operations with base#prefix
Date: Tue, 19 Sep 2023 14:40:53 +0700

Thanks for your response.
In my opinion, in let "<>" and $((<>)) constructs all variables should be
evaluated, so that $-sign for them is to be  just optional

On Tue, Sep 19, 2023 at 2:28 AM Chet Ramey <chet.ramey@case.edu> wrote:

> On 9/17/23 3:59 PM, Victor Pasko wrote:
> > Hi,
> >
> > Could you please take a look at attached bug.bash.
> >
> > Maybe, not all math combinations were presented there or the test has
> > duplications somehow.
> > Here are results of several runs with test# as argument
>
> All the examples use the base#number syntax, where `base' is a (decimal)
> number and `number' is an integer constant in that arithmetic base.
>
> The issues seem to be misunderstandings and unwarranted expectations.
> Several of the test cases use (literal) base10#number, which is an obvious
> error -- the base is a number and doesn't include the word `base'. Others
> seem to assume that the number, which is an integer constant, can include
> non-digits that are out of range for the current base.
>
> For instance, when the base is, say, 32, you can use `res1' as an integer
> constant, because those are all valid in base 32, which uses
> 0123456789abcdefghiklmnopqrstuv as `digits' (if I've counted right). In
> base 10, those are invalid.
>
> There's also some confusion about word expansion. The arguments to `let'
> and the words between $(( and )) undergo the word expansions documented
> in the man page under `Arithmetic Expansion' before the expression goes
> to the arithmetic evaluator. This means that something like `$base10#$res1'
> will expand to a word with the current values of the shell variables
> `base10' and `res1' (e.g., `10#010') before the arithmetic evaluator is
> invoked.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/
>
>

-- 

-- PSK


reply via email to

[Prev in Thread] Current Thread [Next in Thread]