[ https://issues.apache.org/jira/browse/FLEX-24764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13649247#comment-13649247 ]
Justin Mclean edited comment on FLEX-24764 at 5/5/13 2:53 AM: -------------------------------------------------------------- Ouch - how long has this been a bug? Fixed and checked into develop branch. Mustella formatter tests pass. Issue was not Number conversion/rounding as this code also produced the error in both cases tracing "17.77". var nf:mx.formatters.NumberFormatter = new mx.formatters.NumberFormatter(); nf.precision = 2; nf.rounding = "up"; var formatted:String = nf.format(17.76); trace(formatted); var formatted:String = nf.format("17.76"); trace(formatted); was (Author: jmclean): Ouch - how long has this been a bug? Fixed and checked into develop branch. Mustella formatter tests pass. Issue was not Number convert ion as this code also produced the error: var nf:mx.formatters.NumberFormatter = new mx.formatters.NumberFormatter(); nf.precision = 2; nf.rounding = "up"; var formatted:String = nf.format(17.76); trace(formatted); > Applying NumberFormatter.format() to 17.76 returns the incorrect value > ---------------------------------------------------------------------- > > Key: FLEX-24764 > URL: https://issues.apache.org/jira/browse/FLEX-24764 > Project: Apache Flex > Issue Type: Bug > Components: Formatters > Affects Versions: Adobe Flex SDK Previous > Environment: Affected OS(s): All OS Platforms > Affected OS(s): All OS Platforms > Browser: Other (specify version) > Language Found: English > Reporter: Adobe JIRA > Assignee: Justin Mclean > Fix For: Apache Flex 4.10.0 > > > {*** ORIGINALLY POSTED AS ALS-71 ; WAS REQUESTED TO POST IT HERE INSTEAD ***} > Steps to reproduce: > 1. setup a new NumberFormatter() instance, setting the precision to 2 and the > rounding to "up": > var nf:NumberFormatter = new NumberFormatter(); > nf.precision = 2; > nf.rounding = "up"; > 2. Create a var to format the number 17.76: > var num:Number = new Number( nf.format(17.76) ); > 3. Trace the result: > trace(num); > > Actual Results: 17.77 > > Expected Results: 17.76 > In my application my actual number starts out to a precision of 3 (17.760), > but either way I get the same result. Other numbers do not seem to have this > issue. I even tried 18.76, 17.77, 17.75, they all correctly round back to > themselves (because the 3 digit would be interpreted as a 0 ). > I have run into other issues where my number was divided by another and the > result would be something like 13.7000000000001, and even though my interface > only shows 13.70, the rounded correctly formats it to 13.71. However with > this 17.76 number that doesn't seem to be the case. > If this is not a bug, but rather a binary math error please explain why this > number is specifically having the issue so I can relay that to my client. > Specs: > Eclipse 3.4.2 > Flash Builder 4.0 (build 272416) plugin > Project is using the Flex 3.5 SDK > > Workaround (if any): > Add logic to check to see if the value is 17.76 and not format it if it is -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira