Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #7616
| From | Jan Burse <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: BitSet vs BigInteger (false Android doc) |
| Date | 2011-09-06 11:57 +0200 |
| Organization | albasani.net |
| Message-ID | <j44qq9$10g$1@news.albasani.net> (permalink) |
| References | (6 earlier) <_ZGdna1ucfWYH__TnZ2dnUVZ_oudnZ2d@earthlink.com> <j3u3me$k4s$1@news.albasani.net> <4e655c24$0$308$14726298@news.sunsite.dk> <j44ga5$970$1@news.albasani.net> <826a6f26-c540-4ee9-a0c6-1cf77f20d765@glegroupsg2000goo.googlegroups.com> |
Lew schrieb:
> Also, BitSet does indeed have a "not" operation, which it calls 'flip()'.
Sorry, but flip() is not the same as not(). Just compare the
signatures:
flip: Domain x Nat -> Domain
flip(x,n) := xor(x,2^n)
not: Domain -> Domain$
not(x) := xor(x,-1)
This is really where the bitwise operations of BigInteger differentiate
from the bitwise operations of BitSet. BitSet does only know a
potentially infinitely extended sign bit of zero. So all the values
seen as bits are:
...0xxxxxxx
So when you do a BitSet operation between two operands of BitSet,
then the shorter operand is extended so that both sizes match,
before the operation is done (not necessary for all operation). And
this extension works by padding with 0.
In BigInteger we can represent two different bitset patterns.
Namely the either a zero extended indefinitely, for positive
numbers, or a one extended indefinitely, for negative numbers.
So all the values in BigInteger seen as bits are:
...0xxxxxxx or
...1xxxxxxx
The BigInteger operations have two pad eiter with 0 or with 1,
depending on the sign of the given operand. The not() is not
available in BitSet because the -1 is not available in BitSet.
But what concerns the Android comment. It is false because
two's complement is not relevant when we compare BitSet and
BigInteger, because two's complement is one way to represent
a negative number:
...1xxxxxxx
And implicitly the Android comment is also false, since it
implies that two's complement is the only way to represent
negative numbers and it is also false, since it implies
that some of negative number representations have a negative
complexity impact on negative number bitwise operations.
Bye
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-02 21:48 +0200
Re: BitSet vs BigInteger (false Android doc) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-02 16:23 -0400
Re: BitSet vs BigInteger (false Android doc) Patricia Shanahan <pats@acm.org> - 2011-09-02 13:34 -0700
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-02 22:51 +0200
Re: BitSet vs BigInteger (false Android doc) Patricia Shanahan <pats@acm.org> - 2011-09-02 18:58 -0700
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-03 20:15 +0200
Re: BitSet vs BigInteger (false Android doc) Patricia Shanahan <pats@acm.org> - 2011-09-03 12:37 -0700
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-03 22:46 +0200
Re: BitSet vs BigInteger (false Android doc) Patricia Shanahan <pats@acm.org> - 2011-09-03 16:32 -0700
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-04 02:58 +0200
Re: BitSet vs BigInteger (false Android doc) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-05 19:32 -0400
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-06 08:58 +0200
Re: BitSet vs BigInteger (false Android doc) Lew <lewbloch@gmail.com> - 2011-09-06 00:41 -0700
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-06 11:57 +0200
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-06 12:12 +0200
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-06 12:44 +0200
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-06 12:02 +0200
Re: BitSet vs BigInteger (false Android doc) Patricia Shanahan <pats@acm.org> - 2011-09-06 13:38 -0700
Re: BitSet vs BigInteger (false Android doc) Patricia Shanahan <pats@acm.org> - 2011-09-06 10:33 -0700
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-06 22:28 +0200
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-06 22:41 +0200
Re: BitSet vs BigInteger (false Android doc) Patricia Shanahan <pats@acm.org> - 2011-09-06 14:34 -0700
Re: BitSet vs BigInteger (false Android doc) Lew <lewbloch@gmail.com> - 2011-09-06 14:51 -0700
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-07 00:33 +0200
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-07 00:40 +0200
Re: BitSet vs BigInteger (false Android doc) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-05 19:26 -0400
Re: BitSet vs BigInteger (false Android doc) Robert Klemme <shortcutter@googlemail.com> - 2011-09-03 17:01 +0200
Re: BitSet vs BigInteger (false Android doc) Jan Burse <janburse@fastmail.fm> - 2011-09-02 22:49 +0200
Re: BitSet vs BigInteger (false Android doc) Gene Wirchenko <genew@ocis.net> - 2011-09-02 14:48 -0700
Re: BitSet vs BigInteger (false Android doc) Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-09-03 13:54 -0400
csiph-web