zsh-users
 help / color / mirror / code / Atom feed
From: "Jérémie Roquet" <arkanosis@gmail.com>
To: Mark van Dijk <lists+zsh@internecto.net>
Cc: zsh-users@zsh.org
Subject: Re: logical NOT
Date: Thu, 10 May 2012 14:47:18 +0200	[thread overview]
Message-ID: <CAFOazAOiu8mrdM5VVkR3=oG2jF-a0BGR7_ZFkBMHeqCTLBsmxA@mail.gmail.com> (raw)
In-Reply-To: <20120510135934.00f00537@internecto.net>

Hi,

2012/5/10 Mark van Dijk <lists+zsh@internecto.net>:
> % 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


  parent reply	other threads:[~2012-05-10 13:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 11:59 Mark van Dijk
2012-05-10 12:30 ` René Neumann
2012-05-10 12:47 ` Jérémie Roquet [this message]
2012-05-10 15:12 ` Bart Schaefer
2012-05-10 18:02   ` Mikael Magnusson
2012-05-12 11:41     ` Internecto List Subscriber
2012-05-12 11:43     ` Mark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFOazAOiu8mrdM5VVkR3=oG2jF-a0BGR7_ZFkBMHeqCTLBsmxA@mail.gmail.com' \
    --to=arkanosis@gmail.com \
    --cc=lists+zsh@internecto.net \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).