Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 16542 invoked from network); 18 Feb 2011 21:29:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Feb 2011 21:29:54 -0000 Received: (qmail 54453 invoked by uid 500); 18 Feb 2011 21:29:52 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 54427 invoked by uid 500); 18 Feb 2011 21:29:52 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 54419 invoked by uid 99); 18 Feb 2011 21:29:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Feb 2011 21:29:52 +0000 X-ASF-Spam-Status: No, hits=4.6 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL,TRACKER_ID,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.161.44] (HELO mail-fx0-f44.google.com) (209.85.161.44) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Feb 2011 21:29:48 +0000 Received: by fxm15 with SMTP id 15so581231fxm.31 for ; Fri, 18 Feb 2011 13:29:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.81.68 with SMTP id w4mr1597670fak.84.1298064566423; Fri, 18 Feb 2011 13:29:26 -0800 (PST) Received: by 10.223.83.15 with HTTP; Fri, 18 Feb 2011 13:29:26 -0800 (PST) In-Reply-To: References: <1298061333986-6041409.post@n2.nabble.com> <1298061918485-6041430.post@n2.nabble.com> <1298063073866-6041471.post@n2.nabble.com> Date: Fri, 18 Feb 2011 16:29:26 -0500 Message-ID: Subject: Re: Error when bringing up 3rd node From: Ching-Cheng Chen To: user@cassandra.apache.org Cc: Eric Gilmore Content-Type: multipart/alternative; boundary=20cf30434510609372049c9535cf --20cf30434510609372049c9535cf Content-Type: text/plain; charset=ISO-8859-1 try this BigInteger bi = new BigInteger("2"); BigInteger or = new BigInteger("2"); for (int i=1;i<127;i++) { or = or.multiply(bi); } or = or.divide(new BigInteger("3")); for (int i=0;i<3;i++) { System.out.println(or.multiply(new BigInteger(""+i))); } which generate 0 56713727820156410577229101238628035242 113427455640312821154458202477256070484 Regards, Chen www.evidentsoftware.com On Fri, Feb 18, 2011 at 4:24 PM, Eric Gilmore wrote: > I'm not sure I can say exactly why, but I'm sure those numbers can't be > correct. One node should be zero and the other values should be very long > numbers like 85070591730234615865843651857942052863. > > We need another Java expert's opinion here, but it looks like your snippet > may have "integer overflow" > or "integer overload" going on. > > > On Fri, Feb 18, 2011 at 1:04 PM, mcasandra wrote: > >> >> Thanks! This is what I got. Is this right? >> >> public class TokenCalc{ >> public static void main(String ...args){ >> int nodes=3; >> for(int i = 1 ; i <= nodes; i++) { >> System.out.println( (2 ^ 127) / nodes * i); >> } >> } >> } >> >> 41 >> 82 >> 123 >> -- >> View this message in context: >> http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Error-when-bringing-up-3rd-node-tp6041409p6041471.html >> Sent from the cassandra-user@incubator.apache.org mailing list archive at >> Nabble.com. >> > > --20cf30434510609372049c9535cf Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable try this

BigInteger bi =3D new BigInteger("2");
B= igInteger or =3D new BigInteger("2");
fo= r (int i=3D1;i<127;i++) {
or =3D or.multiply(bi);
}
o= r =3D or.divide(new BigInteger("3"));
for = (int i=3D0;i<3;i++) {
System.out.println(or.multiply(new BigInteger(&q= uot;"+i)));
}

which generate

0
=
56713727820156410577229101238628035242
113427455640312821154= 458202477256070484

Regards,

Chen
=

On Fri, Feb 18, 2011 at 4:24= PM, Eric Gilmore <eric@datastax.com> wrote:
I'm not sure I can say exactly why, but= I'm sure those numbers can't be correct.=A0 One node should be zer= o and the other values should be very long numbers like 8507059173023461586= 5843651857942052863.

We need another Java expert's opinion here, but it looks like your = snippet may have "integer overflow"= ; or "integer overload" going on.


On Fri, Feb 18, 2011 a= t 1:04 PM, mcasandra <mohitanchlia@gmail.com> wrote:

Thanks! This is what I got. Is this right?

public class TokenCalc{
=A0public static void main(String ...args){
=A0 =A0 =A0 int nodes=3D3;
=A0 =A0 =A0 for(int i =3D 1 ; i <=3D nodes; i++) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 System.out.println( (2 ^ 127) / nodes * i)= ;
=A0 =A0 =A0 }
=A0}
}

41
82
123
--
View this message in context: http://cassandra-user-incubator-apache-org.30= 65146.n2.nabble.com/Error-when-bringing-up-3rd-node-tp6041409p6041471.html<= /a>
Sent from the cassandra-user@incubator.apache.org= mailing list archive at Nabble.com.


--20cf30434510609372049c9535cf--