Re: Bitwise operation - Mailing list pgsql-sql

From Hubert Lubaczewski
Subject Re: Bitwise operation
Date
Msg-id 20030630143631.794015db.hubert.lubaczewski@eo.pl
Whole thread Raw
In response to Bitwise operation  ("Rudi Starcevic" <rudi@oasis.net.au>)
List pgsql-sql
On Mon, 30 Jun 2003 22:28:15 +1000
"Rudi Starcevic" <rudi@oasis.net.au> wrote:

> SELECT 1111 & 111 = 71
> I was expecting the second example to be 
> SELECT 1111 & 111 = 111

hmm ..:
let's see:
dec(1111) is bin(10001010111)
dec(111)  is bin(00001101111)

so, when we'll "AND" them:
1111 :  10001010111 
111  :  00001101111 
-------------------         00001000111 : dec: 71 

quite reasonable, isn't it?

depesz


pgsql-sql by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: need some help with a delete statement
Next
From: Bruno Wolff III
Date:
Subject: Re: Bitwise operation