Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: logical NOT
- X-seq: zsh-users 17073
- From: Jérémie Roquet <arkanosis@xxxxxxxxx>
- To: Mark van Dijk <lists+zsh@xxxxxxxxxxxxxx>
- Subject: Re: logical NOT
- Date: Thu, 10 May 2012 14:47:18 +0200
- Cc: zsh-users@xxxxxxx
- 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==
- In-reply-to: <20120510135934.00f00537@internecto.net>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20120510135934.00f00537@internecto.net>
Hi,
2012/5/10 Mark van Dijk <lists+zsh@xxxxxxxxxxxxxx>:
> % echo $(( [#2] ~0xAC ))
> -2#10101101
>
> I'd appreciate thoughts on this, and to hear if it makes any sense at
> all :)
16#0xAC = 2#10101100
~16#0xAC = ~2#00000000000000000000000010101100 (this is not “logical
not”, btw, it's “one's complement”)
~16#0xAC = 2#11111111111111111111111101010011
which is a *signed* negative number of value 2#10101101 (see
https://en.wikipedia.org/wiki/Two's_complement)
~16#0xAC = -2#10101101
Makes sense for me… the complement is not limited to the most
significant set bit and the bits on its right, and these are signed
numbers.
Best regards,
--
Jérémie
Messages sorted by:
Reverse Date,
Date,
Thread,
Author