Number – Talk
I delete a reference to Integer, because there is no such type in OFP scripting.
--Suma 11:36, 30 June 2006 (CEST)
Is anyone sure on the precision to which numbers can be stored as variables?
OFP example :
var1 = 123456789 var1 = var1 - 123000000 var1 will return 456792
As a non-programmer, I find this behaviour quite strange. --Ceeeb 08:03, 15 February 2007 (CET)
A test script:
player globalchat format["Precision Test: %1, %2, %3, %4, %5, %6, %7, %8, %9", 1234567 - 1234566, 1234567, 999998+1, 999998+2, 999998+3, (9999999+6)-(10999999), (10000000)-(10999999), 9999999/2 - 4999998, 9999999/2 - 4999998.4];
Which gives:
PRECISION TEST: 1, 1.23457E+006, 999999, 1E+006, 1E+006, -999994, -999999, 1.5, 1
This seems to suggest that you can only store a maximum value of 999999 in a variable. (6 digits)
But, you can use up to 8 digits in integer equations, provided the output is 6 digits or less.
Please do not take the above two statements as fact, since I have done only a few hours of limited testing.
--hellop 09:30, 11 July 2008 (PST)