[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely la
From: |
pjfarley3 |
Subject: |
RE: Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely large inputs |
Date: |
Fri, 28 Jan 2022 20:51:22 -0500 |
> -----Original Message-----
> From: arnold@skeeve.com <arnold@skeeve.com>
> Sent: Friday, January 28, 2022 3:46 AM
> To: pjfarley3@earthlink.net; bug-gawk@gnu.org
> Cc: jasonckwan@yahoo.com
> Subject: Re: Slowness in bignum mode ( gmp | gawk -M ) when doubling
> extremely large inputs
>
> <pjfarley3@earthlink.net> wrote:
>
> > There are also several strange uses of the exclamation point operator
> > (!) that I do not understand, but that is probably just my lack of
> > experience. Examples of such use are:
> >
> > _n1-!!_n1
> > -!-""
> > !+""
> > !--_n10
> >
> > I THINK these are intended to be uses of the negation operator, but I
> > don’t understand what that operation is supposed to do to an empty
> > string.
>
> Using ! converts non-zero to zero and zero to one, depending on the value of
> the expression to which it is applied.
>
> !! <something>
>
> converts <something> into a canonical truth value of 1 or 0. This can
> occasionally be useful in C / C++ as well:
>
> const char *truth_value[] = { "false", "true" };
>
> printf("xyzzy is %s\n", truth_value[!! (some_expression)]);
>
> Arnold
Thanks for the enlightenment Arnold.
So if I understand your explanation correctly, the phrase -!!-"" translates to
this sequence of operations:
1. -"" Minus the empty string, becomes -0 which is still just zero
2. !0 Not 0 becomes 1
3. !1 Not 1 becomes zero
4. -0 Minus 0 which is still just 0
So if I am understanding correctly, the phrase -!!-"" is just a convoluted way
to say "zero"?
Peter
- Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely large inputs, Jason C. Kwan, 2022/01/26
- Re: Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely large inputs, arnold, 2022/01/27
- Re: Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely large inputs, Jason C. Kwan, 2022/01/27
- Re: Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely large inputs, arnold, 2022/01/27
- Re: Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely large inputs, Andrew J. Schorr, 2022/01/27
- Re: Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely large inputs, Jason C. Kwan, 2022/01/27
- Re: Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely large inputs, Andrew J. Schorr, 2022/01/27
- Re: Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely large inputs, Wolfgang Laun, 2022/01/27
- RE: Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely large inputs, pjfarley3, 2022/01/27
- Re: Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely large inputs, arnold, 2022/01/28
- RE: Slowness in bignum mode ( gmp | gawk -M ) when doubling extremely large inputs,
pjfarley3 <=
- Use of !!, arnold, 2022/01/29