You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by "Justin Mclean (JIRA)" <ji...@apache.org> on 2013/04/17 05:13:15 UTC
[jira] [Resolved] (FLEX-14787) Confusing, implicit cast to Number
[ https://issues.apache.org/jira/browse/FLEX-14787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Mclean resolved FLEX-14787.
----------------------------------
Resolution: Fixed
ActionScript / Flash player issue not Flex issue
> Confusing, implicit cast to Number
> ----------------------------------
>
> Key: FLEX-14787
> URL: https://issues.apache.org/jira/browse/FLEX-14787
> Project: Apache Flex
> Issue Type: Bug
> Components: Compiler API
> Affects Versions: Adobe Flex SDK 3.0 (Release)
> Environment: Affected OS(s): All OS Platforms
> Affected OS(s): All OS Platforms
> Browser: Other (specify version)
> Language Found: English
> Reporter: Adobe JIRA
>
> Steps to reproduce:
> Given is the following source:
> var i1:int = 10;
> var i2:int = 100;
> trace( 1.1 - i1 / i2 );
> trace( typeof ( i1 / i2 ) );
>
> Actual Results:
> The code will trace:
> 1
> number
>
> Expected Results:
> It should trace 1.1 and int.
> 10 / 100 is an integer division and takes precedence before the subtraction. Thus it should evaluate to 0.
>
> Workaround (if any):
> Casting the result to int like:
> var i1:int = 10;
> var i2:int = 100;
> trace( 1.1 - int( i1 / i2 ) );
--
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