Difference between revisions of "Category talk:Variables"
Jump to navigation
Jump to search
no edit summary
imported>JOG m (variable range...) |
imported>Nezroy |
||
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 | 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 seen 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.--[[User:JOG|JOG]] 04:08, 13 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.--[[User:JOG|JOG]] 04:08, 13 May 2006 (EDT) | ||
:That would seem to explain it, though in this particular case it was a quest script variable declared as Long that was having issues. Presumably it's also stored as a float similar to globals though. -- [[User:Nezroy|Nezroy]] 02:37, 14 May 2006 (EDT) |