<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to Round Floating point number (Double) to 2 Decimal Points in J2ME JavaME</title>
	<atom:link href="http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/feed" rel="self" type="application/rss+xml" />
	<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html</link>
	<description>Mobile Phone, PDA and JavaME (J2ME) Programming Blog</description>
	<lastBuildDate>Sat, 05 May 2012 21:15:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Grateful Guy</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-15047</link>
		<dc:creator>Grateful Guy</dc:creator>
		<pubDate>Fri, 11 Mar 2011 10:31:45 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-15047</guid>
		<description>Thank you soooo much!!!! Been working on this for ages!</description>
		<content:encoded><![CDATA[<p>Thank you soooo much!!!! Been working on this for ages!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ljubisa Cvetic</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-15044</link>
		<dc:creator>Ljubisa Cvetic</dc:creator>
		<pubDate>Fri, 04 Mar 2011 09:05:34 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-15044</guid>
		<description>Round in Java ME, e.g. in J2ME

The code below is method that shows how to 
round a double to n decimals:

private double round(double num,int numDecim){
    long p=1;
    //next line - calculate pow(10,brDecim)
    for(int i=0;i&lt;numDecim;i++)p*=10;

    return (double)(int)(p*num+0.5)/p;
}

You may use double p=1.0; or p*=10.0; instead.</description>
		<content:encoded><![CDATA[<p>Round in Java ME, e.g. in J2ME</p>
<p>The code below is method that shows how to<br />
round a double to n decimals:</p>
<p>private double round(double num,int numDecim){<br />
    long p=1;<br />
    //next line &#8211; calculate pow(10,brDecim)<br />
    for(int i=0;i&lt;numDecim;i++)p*=10;</p>
<p>    return (double)(int)(p*num+0.5)/p;<br />
}</p>
<p>You may use double p=1.0; or p*=10.0; instead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xD</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-14991</link>
		<dc:creator>xD</dc:creator>
		<pubDate>Fri, 26 Nov 2010 03:40:56 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-14991</guid>
		<description>You are amazing!!!
Thanks a lot

AC/DC Rules
XD</description>
		<content:encoded><![CDATA[<p>You are amazing!!!<br />
Thanks a lot</p>
<p>AC/DC Rules<br />
XD</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexandra Pali</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-14969</link>
		<dc:creator>Alexandra Pali</dc:creator>
		<pubDate>Tue, 26 Oct 2010 23:37:52 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-14969</guid>
		<description>Skip Hop Studio Diaper Tote Tote is awesome.So many pockets - and also not really these modest, worthless pockets, either. All of the storage compartments tend to be a great size and truly assist keep every thing organized. The handles are a fantastic length and fit nicely over the actual shoulder; the tackle shoulder straps also stay place on my own arm, which is actually essential when you&#039;re having a baby. The handbag looks wonderful, as well. Not as well fancy, but not as well casual. (I have it in black) The material is soft (can&#039;t assume of a greater word) so it&#039;s simple to squeeze in to tight spaces - but yet it is sturdy. I have a Fleurville Lexi carry and I love it, as well, but that bag is actually type of inflexible. I believe this Skip*Hop can turn into my everyday tote. It&#039;s a bit big - so if you&#039;re not in to large totes this may well be superior as an over-night baby diaper tote.</description>
		<content:encoded><![CDATA[<p>Skip Hop Studio Diaper Tote Tote is awesome.So many pockets &#8211; and also not really these modest, worthless pockets, either. All of the storage compartments tend to be a great size and truly assist keep every thing organized. The handles are a fantastic length and fit nicely over the actual shoulder; the tackle shoulder straps also stay place on my own arm, which is actually essential when you&#8217;re having a baby. The handbag looks wonderful, as well. Not as well fancy, but not as well casual. (I have it in black) The material is soft (can&#8217;t assume of a greater word) so it&#8217;s simple to squeeze in to tight spaces &#8211; but yet it is sturdy. I have a Fleurville Lexi carry and I love it, as well, but that bag is actually type of inflexible. I believe this Skip*Hop can turn into my everyday tote. It&#8217;s a bit big &#8211; so if you&#8217;re not in to large totes this may well be superior as an over-night baby diaper tote.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lark</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-14915</link>
		<dc:creator>lark</dc:creator>
		<pubDate>Tue, 10 Aug 2010 21:57:58 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-14915</guid>
		<description>This will round not truncate. Math.Pow is my own pow function(). 
     
        double sum = numberToRound;
        double round = .5 / Math.Pow(10, precision+1);
        sum = (sum &gt; 0) ? sum + round : sum - round;
    	int temp=(int)((sum*Math.Pow(10,precision)));
    	sum = (((double)temp)/Math.Pow(10,precision));</description>
		<content:encoded><![CDATA[<p>This will round not truncate. Math.Pow is my own pow function(). </p>
<p>        double sum = numberToRound;<br />
        double round = .5 / Math.Pow(10, precision+1);<br />
        sum = (sum &gt; 0) ? sum + round : sum &#8211; round;<br />
    	int temp=(int)((sum*Math.Pow(10,precision)));<br />
    	sum = (((double)temp)/Math.Pow(10,precision));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: armin</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-14892</link>
		<dc:creator>armin</dc:creator>
		<pubDate>Mon, 28 Jun 2010 12:35:12 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-14892</guid>
		<description>??? ???

thanks</description>
		<content:encoded><![CDATA[<p>??? ???</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ricardo</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-14870</link>
		<dc:creator>Ricardo</dc:creator>
		<pubDate>Fri, 14 May 2010 13:39:01 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-14870</guid>
		<description>maaaaan you saved my day!!! really tks ;D</description>
		<content:encoded><![CDATA[<p>maaaaan you saved my day!!! really tks ;D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Felipe</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-14866</link>
		<dc:creator>Felipe</dc:creator>
		<pubDate>Fri, 07 May 2010 02:53:59 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-14866</guid>
		<description>DONT WORK</description>
		<content:encoded><![CDATA[<p>DONT WORK</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Léo</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-14671</link>
		<dc:creator>Léo</dc:creator>
		<pubDate>Mon, 18 May 2009 17:06:47 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-14671</guid>
		<description>This is not rounding, is trunking.
22.92893723062 turns into 22.9288 and not 22.9289
47.026586582836 turns 47.0265 and not 47.0266</description>
		<content:encoded><![CDATA[<p>This is not rounding, is trunking.<br />
22.92893723062 turns into 22.9288 and not 22.9289<br />
47.026586582836 turns 47.0265 and not 47.0266</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sameer Nafdey</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-14615</link>
		<dc:creator>Sameer Nafdey</dc:creator>
		<pubDate>Thu, 19 Mar 2009 05:46:27 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-14615</guid>
		<description>Awesome! Its a very small snippet but very useful. You saved my hell lot of time. Thanks man. You rocks.</description>
		<content:encoded><![CDATA[<p>Awesome! Its a very small snippet but very useful. You saved my hell lot of time. Thanks man. You rocks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-11751</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Sat, 11 Oct 2008 00:32:09 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-11751</guid>
		<description>Thanks</description>
		<content:encoded><![CDATA[<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: viv</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-10438</link>
		<dc:creator>viv</dc:creator>
		<pubDate>Mon, 01 Sep 2008 17:45:20 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-10438</guid>
		<description>Thanx man</description>
		<content:encoded><![CDATA[<p>Thanx man</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ana</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-9689</link>
		<dc:creator>ana</dc:creator>
		<pubDate>Tue, 22 Jul 2008 18:52:48 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-9689</guid>
		<description>thank u very much!</description>
		<content:encoded><![CDATA[<p>thank u very much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pao</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-9276</link>
		<dc:creator>pao</dc:creator>
		<pubDate>Fri, 13 Jun 2008 23:54:04 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-9276</guid>
		<description>excelent!!!, very very ingenious. You are a genious!! very thanks</description>
		<content:encoded><![CDATA[<p>excelent!!!, very very ingenious. You are a genious!! very thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: taro</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-7886</link>
		<dc:creator>taro</dc:creator>
		<pubDate>Sun, 06 Jan 2008 08:15:42 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-7886</guid>
		<description>thanks lots!</description>
		<content:encoded><![CDATA[<p>thanks lots!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thanasis</title>
		<link>http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html/comment-page-1#comment-2707</link>
		<dc:creator>thanasis</dc:creator>
		<pubDate>Wed, 17 Oct 2007 12:44:59 +0000</pubDate>
		<guid isPermaLink="false">http://mobilepit.com/08/how-to-round-floating-point-number-double-to-2-decimal-points-in-j2me-javame.html#comment-2707</guid>
		<description>thnx</description>
		<content:encoded><![CDATA[<p>thnx</p>
]]></content:encoded>
	</item>
</channel>
</rss>

