Difference between revisions of "Category talk:Variables"
imported>Nezroy m |
imported>JOG |
||
Line 1: | Line 1: | ||
I've noticed that arithmetic on Long values only appears to work in the range of -16777219 to 16777216, which is right about a range of 2^25 (with the positive half being exactly 2^24). You can still store values in the full range expected for a 32-bit var, but doing something like "Set counter To counter + 1" seems to stop working at the ends of this smaller 25-bit range. Has anyone else seent this? -- [[User:Nezroy|Nezroy]] 19:36, 12 May 2006 (EDT) | I've noticed that arithmetic on Long values only appears to work in the range of -16777219 to 16777216, which is right about a range of 2^25 (with the positive half being exactly 2^24). You can still store values in the full range expected for a 32-bit var, but doing something like "Set counter To counter + 1" seems to stop working at the ends of this smaller 25-bit range. Has anyone else seent this? -- [[User:Nezroy|Nezroy]] 19:36, 12 May 2006 (EDT) | ||
See my explanation under [[Variable_types:_floating_point]] whenever you use floating-point arithmetics you have only a 23 bit mantissa (plus implicit 1). Add the exponent (8bit) and the sign (1bit) and you're at 32 bit. Global variables are always floating point, and whenever an expression uses a floating-point number or variable the 24 bit restriction also applies. |
Revision as of 03:07, 13 May 2006
I've noticed that arithmetic on Long values only appears to work in the range of -16777219 to 16777216, which is right about a range of 2^25 (with the positive half being exactly 2^24). You can still store values in the full range expected for a 32-bit var, but doing something like "Set counter To counter + 1" seems to stop working at the ends of this smaller 25-bit range. Has anyone else seent this? -- Nezroy 19:36, 12 May 2006 (EDT)
See my explanation under Variable_types:_floating_point whenever you use floating-point arithmetics you have only a 23 bit mantissa (plus implicit 1). Add the exponent (8bit) and the sign (1bit) and you're at 32 bit. Global variables are always floating point, and whenever an expression uses a floating-point number or variable the 24 bit restriction also applies.