Number – Talk
mNo edit summary |
No edit summary |
||
Line 10: | Line 10: | ||
var1 will return 456'''792''' | var1 will return 456'''792''' | ||
As a non-programmer, I find this behaviour quite strange. --[[User:Ceeeb|Ceeeb]] 08:03, 15 February 2007 (CET) | As a non-programmer, I find this behaviour quite strange. --[[User:Ceeeb|Ceeeb]] 08:03, 15 February 2007 (CET) | ||
---- | |||
A test script:<br> | |||
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];<br> | |||
Which gives:<br> | |||
PRECISION TEST: 1, 1.23457E+006, 999999, 1E+006, 1E+006, -999994, -999999, 1.5, 1<br> | |||
This seems to suggest that you can only store a maximum value of 999999 in a variable. (6 digits)<br> | |||
But, you can use up to 8 digits in integer equations, provided the output is 6 digits or less.<br> | |||
Please do not take the above two statements as fact, since I have done only a few hours of limited testing. | |||
--[[User:hellop|hellop]] 09:30, 11 July 2008 (PST) |
Revision as of 18:06, 11 July 2008
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)