The group you are posting to is a
Usenet group . Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
From:
Nikhanj <nikhan... @gmail.com>
Date: Tue, 9 Oct 2012 03:19:29 -0700 (PDT)
Local: Tues, Oct 9 2012 6:19 am
Subject: rounding off values
Hi, I have a number like this a=0.123456789. I want to round this value to two decimal places. How to do this in gremlin ????
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Michael Hunger <michael.hun... @neotechnology.com>
Date: Tue, 9 Oct 2012 12:26:08 +0200
Local: Tues, Oct 9 2012 6:26 am
Subject: Re: [Neo4j] rounding off values
it is groovy after all.
(0.452334D).round(2)
Am 09.10.2012 um 12:19 schrieb Nikhanj:
> Hi,
> I have a number like this a=0.123456789. I want to round this value to two decimal places. How to do this in gremlin ????
> --
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Nikhanj <nikhan... @gmail.com>
Date: Tue, 9 Oct 2012 03:29:55 -0700 (PDT)
Local: Tues, Oct 9 2012 6:29 am
Subject: Re: [Neo4j] rounding off values
I tried but got No signature of method: java.math.BigDecimal.round() is applicable for argument types: (java.lang.Integer) values: [2]
On Tuesday, 9 October 2012 06:26:19 UTC-4, Michael Hunger wrote:
> it is groovy after all.
> (0.452334D).round(2)
> Am 09.10.2012 um 12:19 schrieb Nikhanj:
> > Hi, > > I have a number like this a=0.123456789. I want to round this value to > two decimal places. How to do this in gremlin ????
> > --
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Nikhanj <nikhan... @gmail.com>
Date: Tue, 9 Oct 2012 03:31:14 -0700 (PDT)
Local: Tues, Oct 9 2012 6:31 am
Subject: Re: [Neo4j] rounding off values
When i try this 0.12345.round(2), i get exception but on doing 0.12345D.round(2) i am able to get the result. Why so???
On Tuesday, 9 October 2012 06:29:55 UTC-4, Nikhanj wrote:
> I tried but got > No signature of method: java.math.BigDecimal.round() is applicable for argument types: (java.lang.Integer) values: [2]
> On Tuesday, 9 October 2012 06:26:19 UTC-4, Michael Hunger wrote:
>> it is groovy after all.
>> (0.452334D).round(2)
>> Am 09.10.2012 um 12:19 schrieb Nikhanj:
>> > Hi, >> > I have a number like this a=0.123456789. I want to round this value to >> two decimal places. How to do this in gremlin ????
>> > --
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Michael Hunger <michael.hun... @neotechnology.com>
Date: Tue, 9 Oct 2012 12:46:53 +0200
Local: Tues, Oct 9 2012 6:46 am
Subject: Re: [Neo4j] rounding off values
if you append a D it is a double.
for bigdecimals there is
1.233434.setScale(2,BigDecimal.ROUND_HALF_UP)
Am 09.10.2012 um 12:31 schrieb Nikhanj:
> When i try this 0.12345.round(2), i get exception but on doing 0.12345D.round(2) i am able to get the result. Why so???
> On Tuesday, 9 October 2012 06:29:55 UTC-4, Nikhanj wrote:
> I tried but got No signature of method: java.math.BigDecimal.round() is applicable for argument types: (java.lang.Integer) values: [2]
> On Tuesday, 9 October 2012 06:26:19 UTC-4, Michael Hunger wrote:
> it is groovy after all.
> (0.452334D).round(2)
> Am 09.10.2012 um 12:19 schrieb Nikhanj:
> > Hi, > > I have a number like this a=0.123456789. I want to round this value to two decimal places. How to do this in gremlin ????
> > --
> --
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Nikhanj <nikhan... @gmail.com>
Date: Tue, 9 Oct 2012 04:05:45 -0700 (PDT)
Local: Tues, Oct 9 2012 7:05 am
Subject: Re: [Neo4j] rounding off values
Thanks Michael!!! It works
On Tuesday, 9 October 2012 06:47:09 UTC-4, Michael Hunger wrote:
> if you append a D it is a double.
> for bigdecimals there is
> 1.233434.setScale(2,BigDecimal.ROUND_HALF_UP)
> Am 09.10.2012 um 12:31 schrieb Nikhanj:
> When i try this 0.12345.round(2), i get exception but on doing > 0.12345D.round(2) i am able to get the result. Why so???
> On Tuesday, 9 October 2012 06:29:55 UTC-4, Nikhanj wrote:
>> I tried but got >> No signature of method: java.math.BigDecimal.round() is applicable for argument types: (java.lang.Integer) values: [2]
>> On Tuesday, 9 October 2012 06:26:19 UTC-4, Michael Hunger wrote:
>>> it is groovy after all.
>>> (0.452334D).round(2)
>>> Am 09.10.2012 um 12:19 schrieb Nikhanj:
>>> > Hi, >>> > I have a number like this a=0.123456789. I want to round this value to >>> two decimal places. How to do this in gremlin ????
>>> > --
> --
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Marko Rodriguez <okramma... @gmail.com>
Date: Tue, 9 Oct 2012 08:04:41 -0600
Local: Tues, Oct 9 2012 10:04 am
Subject: Re: [Neo4j] rounding off values
Hi,
You can simply use:
Math.round(a);
gremlin> a=0.123456789
==>0.123456789
gremlin> Math.round(a)
==>0
To decide to what decimal you want, you can multiply and divide:
gremlin> Math.round(a * 100) / 100
==>0.12
Note that Gremlin has full access to the Java and Groovy APIs, so:
http://stackoverflow.com/questions/153724/how-to-round-a-number-to-n-...
HTH,
Marko.
http://thinkaurelius.com
On Oct 9, 2012, at 4:19 AM, Nikhanj wrote:
> Hi,
> I have a number like this a=0.123456789. I want to round this value to two decimal places. How to do this in gremlin ????
> --
You must
Sign in before you can post messages.
You do not have the permission required to post.