<?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: Rounding numbers in Flex using the NumberFormatter class</title>
	<atom:link href="http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Sun, 12 Feb 2012 19:26:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: ejiro</title>
		<link>http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/comment-page-1/#comment-10366</link>
		<dc:creator>ejiro</dc:creator>
		<pubDate>Sun, 05 Feb 2012 05:48:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/#comment-10366</guid>
		<description>How can I zerofill an output result, integer ?</description>
		<content:encoded><![CDATA[<p>How can I zerofill an output result, integer ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Al</title>
		<link>http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/comment-page-1/#comment-9580</link>
		<dc:creator>Al</dc:creator>
		<pubDate>Fri, 09 Sep 2011 21:33:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/#comment-9580</guid>
		<description>So, given a NumberFormatter with these settings:
decimalSeparatorTo=&quot;.&quot; 
rounding=&quot;nearest&quot;
precision=&quot;2&quot; 
useThousandsSeparator=&quot;false&quot;

Why do these numbers round to .51 as intended:
[Bindable]
private var numString1:String = &quot;5.5050&quot;;
[Bindable]
private var numString2:String = &quot;85.5050&quot;;
[Bindable]
private var numString3:String = &quot;485.5050&quot;;

But this number rounds incorrectly to .50 ???
[Bindable]
private var numString4:String = &quot;8485.5050&quot;;

More importantly, how does one work around this, when the popular *1000 / 1000 trick doesn&#039;t seem to work?</description>
		<content:encoded><![CDATA[<p>So, given a NumberFormatter with these settings:<br />
decimalSeparatorTo=&#8221;.&#8221;<br />
rounding=&#8221;nearest&#8221;<br />
precision=&#8221;2&#8243;<br />
useThousandsSeparator=&#8221;false&#8221;</p>
<p>Why do these numbers round to .51 as intended:<br />
[Bindable]<br />
private var numString1:String = &#8220;5.5050&#8243;;<br />
[Bindable]<br />
private var numString2:String = &#8220;85.5050&#8243;;<br />
[Bindable]<br />
private var numString3:String = &#8220;485.5050&#8243;;</p>
<p>But this number rounds incorrectly to .50 ???<br />
[Bindable]<br />
private var numString4:String = &#8220;8485.5050&#8243;;</p>
<p>More importantly, how does one work around this, when the popular *1000 / 1000 trick doesn&#8217;t seem to work?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Muhammad Imran</title>
		<link>http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/comment-page-1/#comment-9213</link>
		<dc:creator>Muhammad Imran</dc:creator>
		<pubDate>Thu, 12 May 2011 06:43:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/#comment-9213</guid>
		<description>I am looking a textInput Field in which I can restrict first three numaric values and further three alphabet in maxChar 6.
Please send me a solution.


Thanks In Advance.
M.Imran
0092-321-602-8608</description>
		<content:encoded><![CDATA[<p>I am looking a textInput Field in which I can restrict first three numaric values and further three alphabet in maxChar 6.<br />
Please send me a solution.</p>
<p>Thanks In Advance.<br />
M.Imran<br />
0092-321-602-8608</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/comment-page-1/#comment-7697</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Thu, 13 May 2010 17:27:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/#comment-7697</guid>
		<description>@Molaro,

I don&#039;t think this is an Adobe bug. My understanding is that it is just an unforunate side effect of floating point math.
That said, I found the following bugs filed against Flash Player on similar topics:
http://bugs.adobe.com/jira/browse/FP-3042
http://bugs.adobe.com/jira/browse/FP-3044
http://bugs.adobe.com/jira/browse/FP-3738
http://bugs.adobe.com/jira/browse/FP-4407

As well as the following helpful links:
http://kb2.adobe.com/cps/139/tn_13989.html 
http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems 

Peter</description>
		<content:encoded><![CDATA[<p>@Molaro,</p>
<p>I don&#8217;t think this is an Adobe bug. My understanding is that it is just an unforunate side effect of floating point math.<br />
That said, I found the following bugs filed against Flash Player on similar topics:<br />
<a href="http://bugs.adobe.com/jira/browse/FP-3042" rel="nofollow">http://bugs.adobe.com/jira/browse/FP-3042</a><br />
<a href="http://bugs.adobe.com/jira/browse/FP-3044" rel="nofollow">http://bugs.adobe.com/jira/browse/FP-3044</a><br />
<a href="http://bugs.adobe.com/jira/browse/FP-3738" rel="nofollow">http://bugs.adobe.com/jira/browse/FP-3738</a><br />
<a href="http://bugs.adobe.com/jira/browse/FP-4407" rel="nofollow">http://bugs.adobe.com/jira/browse/FP-4407</a></p>
<p>As well as the following helpful links:<br />
<a href="http://kb2.adobe.com/cps/139/tn_13989.html" rel="nofollow">http://kb2.adobe.com/cps/139/tn_13989.html</a><br />
<a href="http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems" rel="nofollow">http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems</a> </p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Molaro</title>
		<link>http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/comment-page-1/#comment-7694</link>
		<dc:creator>Molaro</dc:creator>
		<pubDate>Thu, 13 May 2010 14:53:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/#comment-7694</guid>
		<description>Peter, thanks for the reply.  I have seen that before and usually if I trace out the division of the 2 numbers I use to get that number (17.76), I can see that longer value.  But in this case I have littler just keyed in the number into my own test code as well as your demo and see the same issue.  I&#039;ll keep looking.  

I logged this as a possible bug with Adobe hoping they can provide an explanation if it isn&#039;t a bug.  

Honestly, given that it 17.76, the year of our independence, I sort of assumed some odd developer bug/Easter egg!</description>
		<content:encoded><![CDATA[<p>Peter, thanks for the reply.  I have seen that before and usually if I trace out the division of the 2 numbers I use to get that number (17.76), I can see that longer value.  But in this case I have littler just keyed in the number into my own test code as well as your demo and see the same issue.  I&#8217;ll keep looking.  </p>
<p>I logged this as a possible bug with Adobe hoping they can provide an explanation if it isn&#8217;t a bug.  </p>
<p>Honestly, given that it 17.76, the year of our independence, I sort of assumed some odd developer bug/Easter egg!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/comment-page-1/#comment-7655</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Thu, 06 May 2010 19:13:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/#comment-7655</guid>
		<description>@Molaro,

This is just a guess, but sometimes JavaScript/ActionScript and many other languages store seemingly simple values like &quot;17.76&quot; internally as &quot;17.760000000000005&quot;. So this may be an artifact of the floating point math. So your value of 17.76 has that trailing &quot;0000000000005&quot; which is causing it to get rounded up.

But again, this is just a guess and I could be very wrong. But for a bit more info on my theory, see http://stackoverflow.com/questions/588004/is-javascripts-math-broken

Peter</description>
		<content:encoded><![CDATA[<p>@Molaro,</p>
<p>This is just a guess, but sometimes JavaScript/ActionScript and many other languages store seemingly simple values like &#8220;17.76&#8243; internally as &#8220;17.760000000000005&#8243;. So this may be an artifact of the floating point math. So your value of 17.76 has that trailing &#8220;0000000000005&#8243; which is causing it to get rounded up.</p>
<p>But again, this is just a guess and I could be very wrong. But for a bit more info on my theory, see <a href="http://stackoverflow.com/questions/588004/is-javascripts-math-broken" rel="nofollow">http://stackoverflow.com/questions/588004/is-javascripts-math-broken</a></p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Molaro</title>
		<link>http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/comment-page-1/#comment-7654</link>
		<dc:creator>Molaro</dc:creator>
		<pubDate>Thu, 06 May 2010 18:35:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/#comment-7654</guid>
		<description>So, I am having a rounding issue and this app is helping me sort of confirm the issue.  Can you explain why if I put it:
45.68 the rounding UP value is 45.68  (and not 45.69)

If I put in 17.76 (my problem number in my personal app), the round UP is 17.77  (and not 17.76 like the first example)

Overall, with a precision of 2, and rounding up, all my numbers in my app round like the first example, 45.68, however 17.76 actually rounds up.  Can you explain this???  (Flex 3.5)</description>
		<content:encoded><![CDATA[<p>So, I am having a rounding issue and this app is helping me sort of confirm the issue.  Can you explain why if I put it:<br />
45.68 the rounding UP value is 45.68  (and not 45.69)</p>
<p>If I put in 17.76 (my problem number in my personal app), the round UP is 17.77  (and not 17.76 like the first example)</p>
<p>Overall, with a precision of 2, and rounding up, all my numbers in my app round like the first example, 45.68, however 17.76 actually rounds up.  Can you explain this???  (Flex 3.5)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hervé</title>
		<link>http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/comment-page-1/#comment-2120</link>
		<dc:creator>Hervé</dc:creator>
		<pubDate>Wed, 01 Apr 2009 13:46:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/#comment-2120</guid>
		<description>restrict=&quot;[0-9.-]&quot;

would be :

restrict=&quot;[0-9.\-]&quot; in mxml
and
restrict=&quot;[0-9.\\-]&quot; in actionscript</description>
		<content:encoded><![CDATA[<p>restrict=&#8221;[0-9.-]&#8221;</p>
<p>would be :</p>
<p>restrict=&#8221;[0-9.\-]&#8221; in mxml<br />
and<br />
restrict=&#8221;[0-9.\\-]&#8221; in actionscript</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lucas</title>
		<link>http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/comment-page-1/#comment-2121</link>
		<dc:creator>Lucas</dc:creator>
		<pubDate>Sat, 13 Dec 2008 11:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/13/rounding-numbers-in-flex-using-the-numberformatter-class/#comment-2121</guid>
		<description>Very good, thank&#039;s!</description>
		<content:encoded><![CDATA[<p>Very good, thank&#8217;s!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

