<?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: AS3 Interesting Numeric Storage Behavior</title>
	<atom:link href="http://drawlogic.com/2007/06/06/as3-interesting-numeric-storage-behavior/feed/" rel="self" type="application/rss+xml" />
	<link>http://drawlogic.com/2007/06/06/as3-interesting-numeric-storage-behavior/</link>
	<description>interactive and game development technologies for the web - flash, flex, unity3d, silverlight, javascript</description>
	<lastBuildDate>Sat, 03 Mar 2012 05:55:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Dodeca</title>
		<link>http://drawlogic.com/2007/06/06/as3-interesting-numeric-storage-behavior/comment-page-1/#comment-2703</link>
		<dc:creator>Dodeca</dc:creator>
		<pubDate>Thu, 09 Apr 2009 00:00:53 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/2007/06/06/as3-interesting-numeric-storage-behavior/#comment-2703</guid>
		<description>I have to side with Quantium - the post as written is extremely misleading. Specifically, this:

&quot;The internal findings when storing a uint 

    From 0 to 27 it is int
    From 28 to 31 it is Number
    From 32 to 59 it is int (again)
    From 60 to 63 it is Number (again) …&quot;

Should be

&quot;The internal findings when storing a uint 

    From 1 &lt;&lt; 0 to 1 &lt;&lt; 27 it is int
    From 1 &lt;&lt; 28 to 1 &lt;&lt; 31 it is Number
    From 1 &lt;&lt; 32 to 1 &lt;&lt; 59 it is int (again)
    From 1 &lt;&lt; 60 to 1 &lt;&lt; 63 it is Number (again) …&quot;

Otherwise it is easy to think that uints should only be used when the expected value is from 0 to 27!</description>
		<content:encoded><![CDATA[<p>I have to side with Quantium &#8211; the post as written is extremely misleading. Specifically, this:</p>
<p>&#8220;The internal findings when storing a uint </p>
<p>    From 0 to 27 it is int<br />
    From 28 to 31 it is Number<br />
    From 32 to 59 it is int (again)<br />
    From 60 to 63 it is Number (again) …&#8221;</p>
<p>Should be</p>
<p>&#8220;The internal findings when storing a uint </p>
<p>    From 1 &lt;&lt; 0 to 1 &lt;&lt; 27 it is int<br />
    From 1 &lt;&lt; 28 to 1 &lt;&lt; 31 it is Number<br />
    From 1 &lt;&lt; 32 to 1 &lt;&lt; 59 it is int (again)<br />
    From 1 &lt;&lt; 60 to 1 &lt;&lt; 63 it is Number (again) …&#8221;</p>
<p>Otherwise it is easy to think that uints should only be used when the expected value is from 0 to 27!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tenegri&#8217;s blog &#187; Blog Archive &#187; Are there real int and uint types?</title>
		<link>http://drawlogic.com/2007/06/06/as3-interesting-numeric-storage-behavior/comment-page-1/#comment-229</link>
		<dc:creator>Tenegri&#8217;s blog &#187; Blog Archive &#187; Are there real int and uint types?</dc:creator>
		<pubDate>Sat, 03 May 2008 15:19:36 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/2007/06/06/as3-interesting-numeric-storage-behavior/#comment-229</guid>
		<description>[...] Ryan Christensen: AS3 Interesting Numeric Storage Behavior Andre Michelle: Weird behavior of numbers in as3 Michael Baczynski: Bitwise gems - fast integer math Michael Baczynski: Int, uint and number data type conversion Sho Kuwamoto: Avoid ints in ActionScript Grant Skinner: Types in AS3: ints not so fast, uints slow!   This entry was posted on Saturday, May 3rd, 2008 at 16:19 and is filed under Nincs kategorizálva. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.    &#171; ApplicationDomain - parent and child [...]</description>
		<content:encoded><![CDATA[<p>[...] Ryan Christensen: AS3 Interesting Numeric Storage Behavior Andre Michelle: Weird behavior of numbers in as3 Michael Baczynski: Bitwise gems &#8211; fast integer math Michael Baczynski: Int, uint and number data type conversion Sho Kuwamoto: Avoid ints in ActionScript Grant Skinner: Types in AS3: ints not so fast, uints slow!   This entry was posted on Saturday, May 3rd, 2008 at 16:19 and is filed under Nincs kategorizálva. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.    &laquo; ApplicationDomain &#8211; parent and child [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stuart currie</title>
		<link>http://drawlogic.com/2007/06/06/as3-interesting-numeric-storage-behavior/comment-page-1/#comment-230</link>
		<dc:creator>stuart currie</dc:creator>
		<pubDate>Wed, 06 Feb 2008 22:59:44 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/2007/06/06/as3-interesting-numeric-storage-behavior/#comment-230</guid>
		<description>BINGO! heres the theorm behind this pattern. see if you can spot why the answer you have is the cause of this.  0+1+1+2+4+8+16+32+64+128...etc</description>
		<content:encoded><![CDATA[<p>BINGO! heres the theorm behind this pattern. see if you can spot why the answer you have is the cause of this.  0+1+1+2+4+8+16+32+64+128&#8230;etc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Quantium</title>
		<link>http://drawlogic.com/2007/06/06/as3-interesting-numeric-storage-behavior/comment-page-1/#comment-231</link>
		<dc:creator>Quantium</dc:creator>
		<pubDate>Fri, 19 Oct 2007 16:19:24 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/2007/06/06/as3-interesting-numeric-storage-behavior/#comment-231</guid>
		<description>i&#039;m agree Andre Michelle didn&#039;t know about he talking about. but I thing this test is a little distorted. May be if you put entire data in trace, including num value. I did the test tracing the entire data and the result was this:

			var num: uint;

			for (var i: int = 0; i &lt; 64; i++)
			{
			 num = 1 &lt;&lt; i;

			 trace( i, getQualifiedClassName( num ) , num);
			}



0 int 1
1 int 2
2 int 4
3 int 8
4 int 16
5 int 32
6 int 64
7 int 128
8 int 256
9 int 512
10 int 1024
11 int 2048
12 int 4096
13 int 8192
14 int 16384
15 int 32768
16 int 65536
17 int 131072
18 int 262144
19 int 524288
20 int 1048576
21 int 2097152
22 int 4194304
23 int 8388608
24 int 16777216
25 int 33554432
26 int 67108864
27 int 134217728
28 Number 268435456
29 Number 536870912
30 Number 1073741824
31 Number 2147483648
32 int 1
33 int 2
34 int 4
35 int 8
36 int 16
37 int 32
38 int 64
39 int 128
40 int 256
41 int 512
42 int 1024
43 int 2048
44 int 4096
45 int 8192
46 int 16384
47 int 32768
48 int 65536
49 int 131072
50 int 262144
51 int 524288
52 int 1048576
53 int 2097152
54 int 4194304
55 int 8388608
56 int 16777216
57 int 33554432
58 int 67108864
59 int 134217728
60 Number 268435456
61 Number 536870912
62 Number 1073741824
63 Number 2147483648

The Adobe Guys must to filter this issue, but in some way a programmer should understand this bad function in interpreted languages.</description>
		<content:encoded><![CDATA[<p>i&#8217;m agree Andre Michelle didn&#8217;t know about he talking about. but I thing this test is a little distorted. May be if you put entire data in trace, including num value. I did the test tracing the entire data and the result was this:</p>
<p>			var num: uint;</p>
<p>			for (var i: int = 0; i &lt; 64; i++)<br />
			{<br />
			 num = 1 &lt;&lt; i;</p>
<p>			 trace( i, getQualifiedClassName( num ) , num);<br />
			}</p>
<p>0 int 1<br />
1 int 2<br />
2 int 4<br />
3 int 8<br />
4 int 16<br />
5 int 32<br />
6 int 64<br />
7 int 128<br />
8 int 256<br />
9 int 512<br />
10 int 1024<br />
11 int 2048<br />
12 int 4096<br />
13 int 8192<br />
14 int 16384<br />
15 int 32768<br />
16 int 65536<br />
17 int 131072<br />
18 int 262144<br />
19 int 524288<br />
20 int 1048576<br />
21 int 2097152<br />
22 int 4194304<br />
23 int 8388608<br />
24 int 16777216<br />
25 int 33554432<br />
26 int 67108864<br />
27 int 134217728<br />
28 Number 268435456<br />
29 Number 536870912<br />
30 Number 1073741824<br />
31 Number 2147483648<br />
32 int 1<br />
33 int 2<br />
34 int 4<br />
35 int 8<br />
36 int 16<br />
37 int 32<br />
38 int 64<br />
39 int 128<br />
40 int 256<br />
41 int 512<br />
42 int 1024<br />
43 int 2048<br />
44 int 4096<br />
45 int 8192<br />
46 int 16384<br />
47 int 32768<br />
48 int 65536<br />
49 int 131072<br />
50 int 262144<br />
51 int 524288<br />
52 int 1048576<br />
53 int 2097152<br />
54 int 4194304<br />
55 int 8388608<br />
56 int 16777216<br />
57 int 33554432<br />
58 int 67108864<br />
59 int 134217728<br />
60 Number 268435456<br />
61 Number 536870912<br />
62 Number 1073741824<br />
63 Number 2147483648</p>
<p>The Adobe Guys must to filter this issue, but in some way a programmer should understand this bad function in interpreted languages.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: drawk</title>
		<link>http://drawlogic.com/2007/06/06/as3-interesting-numeric-storage-behavior/comment-page-1/#comment-226</link>
		<dc:creator>drawk</dc:creator>
		<pubDate>Tue, 12 Jun 2007 22:47:50 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/2007/06/06/as3-interesting-numeric-storage-behavior/#comment-226</guid>
		<description>Hey Nate,

Yeh the uint constantly does conversions from int to Number so that is slower by far, conversions are expensive.  The important thing is I guess is to go with one type and stick with it. Conversions are the bottleneck in uint when bitwise operations happen.</description>
		<content:encoded><![CDATA[<p>Hey Nate,</p>
<p>Yeh the uint constantly does conversions from int to Number so that is slower by far, conversions are expensive.  The important thing is I guess is to go with one type and stick with it. Conversions are the bottleneck in uint when bitwise operations happen.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate Chatellier</title>
		<link>http://drawlogic.com/2007/06/06/as3-interesting-numeric-storage-behavior/comment-page-1/#comment-225</link>
		<dc:creator>Nate Chatellier</dc:creator>
		<pubDate>Tue, 12 Jun 2007 22:31:56 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/2007/06/06/as3-interesting-numeric-storage-behavior/#comment-225</guid>
		<description>It&#039;s interesting, Sho claims that his tests led him to believe that Numbers may actually be faster than ints in Flash:
http://kuwamoto.org/2006/06/15/avoid-ints-in-actionscript/

Grant Skinner&#039;s tests showed that ints had only a small improvement over Number, but uint was much worse then either:
http://www.gskinner.com/blog/archives/2006/06/types_in_as3_in.html

It seems like the only consistent claim is that numerical data types in Flash are inconsistent ;)</description>
		<content:encoded><![CDATA[<p>It&#8217;s interesting, Sho claims that his tests led him to believe that Numbers may actually be faster than ints in Flash:<br />
<a href="http://kuwamoto.org/2006/06/15/avoid-ints-in-actionscript/" rel="nofollow">http://kuwamoto.org/2006/06/15/avoid-ints-in-actionscript/</a></p>
<p>Grant Skinner&#8217;s tests showed that ints had only a small improvement over Number, but uint was much worse then either:<br />
<a href="http://www.gskinner.com/blog/archives/2006/06/types_in_as3_in.html" rel="nofollow">http://www.gskinner.com/blog/archives/2006/06/types_in_as3_in.html</a></p>
<p>It seems like the only consistent claim is that numerical data types in Flash are inconsistent <img src='http://drawlogic.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: drawk</title>
		<link>http://drawlogic.com/2007/06/06/as3-interesting-numeric-storage-behavior/comment-page-1/#comment-228</link>
		<dc:creator>drawk</dc:creator>
		<pubDate>Fri, 08 Jun 2007 23:15:34 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/2007/06/06/as3-interesting-numeric-storage-behavior/#comment-228</guid>
		<description>Drj11,

Yes it has to do with the underlying framework that runs probably in C or C++ that runs the virtual machine.  This only happens when doing performance tweaks like bitwise shifts because it accesses the type faster due to direct memory but because there is no wrapper (I am speculating) then it passes the types back without any filtering.

This does not happen on a normal loop with a typed iterator only performance areas where bitwise shifts are faster (which are in many places stop by polygonal labs to see that the cleanest code or simplest code is not always the fastest).  Optimization can sometimes be a gotcha. Now on iterations using bitwise on a high performance app there will be slowdowns appearing in the range where Numbers appear rather than int. Again, not a big deal if you aren&#039;t really looking to extend every bit of performance you can out of the flash vm, for most purposes its overkill.  When doing games and other really high concurrent systems like that it becomes an issue. (i.e. iterating over objects in a multiplayer map rapidly)</description>
		<content:encoded><![CDATA[<p>Drj11,</p>
<p>Yes it has to do with the underlying framework that runs probably in C or C++ that runs the virtual machine.  This only happens when doing performance tweaks like bitwise shifts because it accesses the type faster due to direct memory but because there is no wrapper (I am speculating) then it passes the types back without any filtering.</p>
<p>This does not happen on a normal loop with a typed iterator only performance areas where bitwise shifts are faster (which are in many places stop by polygonal labs to see that the cleanest code or simplest code is not always the fastest).  Optimization can sometimes be a gotcha. Now on iterations using bitwise on a high performance app there will be slowdowns appearing in the range where Numbers appear rather than int. Again, not a big deal if you aren&#8217;t really looking to extend every bit of performance you can out of the flash vm, for most purposes its overkill.  When doing games and other really high concurrent systems like that it becomes an issue. (i.e. iterating over objects in a multiplayer map rapidly)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: drj11</title>
		<link>http://drawlogic.com/2007/06/06/as3-interesting-numeric-storage-behavior/comment-page-1/#comment-224</link>
		<dc:creator>drj11</dc:creator>
		<pubDate>Fri, 08 Jun 2007 08:48:19 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/2007/06/06/as3-interesting-numeric-storage-behavior/#comment-224</guid>
		<description>I don&#039;t know the first thing about AS3, but I suspect that «1 &lt;&lt; i» is the same as «1 &lt;&lt; (i &amp; 0x1f)».  That is, only the bottom 5 bits of i are used to perform the shift, so the actual shift is always from 0 to 31 regardles of how large i gets.

You don&#039;t print out the value of num, but I suspect you&#039;ll find that «1 &lt;&lt; 1» is the same as «1 &lt;&lt; 33».  If so, it inherits this behaviour from the SHL instruction on Intel architectures.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know the first thing about AS3, but I suspect that «1 &lt;&lt; i» is the same as «1 &lt;&lt; (i &amp; 0x1f)».  That is, only the bottom 5 bits of i are used to perform the shift, so the actual shift is always from 0 to 31 regardles of how large i gets.</p>
<p>You don&#8217;t print out the value of num, but I suspect you&#8217;ll find that «1 &lt;&lt; 1» is the same as «1 &lt;&lt; 33».  If so, it inherits this behaviour from the SHL instruction on Intel architectures.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: awflasher</title>
		<link>http://drawlogic.com/2007/06/06/as3-interesting-numeric-storage-behavior/comment-page-1/#comment-227</link>
		<dc:creator>awflasher</dc:creator>
		<pubDate>Thu, 07 Jun 2007 06:09:44 +0000</pubDate>
		<guid isPermaLink="false">http://drawk.wordpress.com/2007/06/06/as3-interesting-numeric-storage-behavior/#comment-227</guid>
		<description>Numbers are so strange in AS3 ...</description>
		<content:encoded><![CDATA[<p>Numbers are so strange in AS3 &#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

