Difference between revisions of "Talk:Long Integer"
More Precision tests
imported>Haama |
imported>JRoush (More Precision tests) |
||
Line 45: | Line 45: | ||
:[http://www.bethsoft.com/bgsforums/index.php?showtopic=826285 A bit more information in this thread - you can't accurately multiply large numbers by -1 and modulus seems to work with double precision.]--[[User:Haama|Haama]] 21:26, 30 March 2008 (EDT) | :[http://www.bethsoft.com/bgsforums/index.php?showtopic=826285 A bit more information in this thread - you can't accurately multiply large numbers by -1 and modulus seems to work with double precision.]--[[User:Haama|Haama]] 21:26, 30 March 2008 (EDT) | ||
== More Precision tests == | |||
From what the obse guys have decoded of the scripting system, it seems that long variables are stored as double-precision floating point numbers. The double format has something like 52 bits in the mantissa, so a long should be quite able to store any valid 32-bit number. My own tests with a custom script function (added by an obse plugin) confirm this. | |||
There are a couple caveats: | |||
*This only covers assigning to, and retrieving from, the variable. I've not tested the arithmetic operations, but from all the previous posts it seems likely they are more limited. | |||
*The sign bit in a double isn't quite the same as the sign bit in an integer, so only carefully written script functions will be able to access this bit correctly (what would be the most significant bit in an unsigned integer). | |||
--[[User:JRoush|JRoush]] 17:19, 29 June 2010 (EDT) |