From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 171 invoked by alias); 10 May 2012 13:11:00 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17073 Received: (qmail 13579 invoked from network); 10 May 2012 13:10:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.212.177 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=Zg1KMNYJmJ2vxYYry3Lj2DeJUH15NOdrBPW75pNPpLE=; b=oAkGorNOj2gzIeYAO84fAXbWPz+rzXvPgYGtDlaDI8NsBte/iSZHCdxFhFueoA9qFM +2/9ozjDO+l7i4gesUjBU9t6ffROhQomON/hXV3yHQKK2Smodx5d0X9HfgZwoZ2Y3FEF tmWZ+HkcfCxz4K7bSkMYwgmY8EfqohujIylpetn+oX1T5CnNwbOabju3yNpyxzyV9PHn 18yeh41C7VEn5P1Sapaz9F+W1khxze9KsE9bFtpGnhn5W6sL46xLxQIV9QDMh7CZLDXJ LvZ2e3WbwHIMX8CtTRf0XCKj/T3M9j5+J+CpnXX230C4KOzDDpSlTCBMnlw+fwZr6l3G Esmg== MIME-Version: 1.0 In-Reply-To: <20120510135934.00f00537@internecto.net> References: <20120510135934.00f00537@internecto.net> From: =?UTF-8?B?SsOpcsOpbWllIFJvcXVldA==?= Date: Thu, 10 May 2012 14:47:18 +0200 Message-ID: Subject: Re: logical NOT To: Mark van Dijk Cc: zsh-users@zsh.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, 2012/5/10 Mark van Dijk : > % echo $(( [#2] ~0xAC )) > -2#10101101 > > I'd appreciate thoughts on this, and to hear if it makes any sense at > all :) 16#0xAC =3D 2#10101100 ~16#0xAC =3D ~2#00000000000000000000000010101100 (this is not =E2=80=9Clogi= cal not=E2=80=9D, btw, it's =E2=80=9Cone's complement=E2=80=9D) ~16#0xAC =3D 2#11111111111111111111111101010011 which is a *signed* negative number of value 2#10101101 (see https://en.wikipedia.org/wiki/Two's_complement) ~16#0xAC =3D -2#10101101 Makes sense for me=E2=80=A6 the complement is not limited to the most significant set bit and the bits on its right, and these are signed numbers. Best regards, --=20 J=C3=A9r=C3=A9mie