Page tree
Skip to end of metadata
Go to start of metadata




Introduced in

Version:1.31

Description

Description:

Allows you to add or subtract numbers of any number of digits, without losing any precision. The result is saved as a string.

Note: Very large or very small numbers are compressed into scientific notation, but these can still only be 6 digits long, in total.

Syntax

Syntax:[numbers] call fn_vbs_highPrecisionAdd
Parameters:
Return Value:String - Sum of the inputs, in full digit precision.

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
[100,.0001] call fn_vbs_highPrecisionAdd
// Returns "100.0001"

["-123456789",-0.123456,"-0.000000789"] call fn_vbs_highPrecisionAdd
// Returns "-123456789.123456789"

Additional Information

See also:
Multiplayer:
Problems:

Notes






Remember that the results are only as good as the inputs. For example, if you input the number 1234567, VBS will round that number to 123457
before
this function gets to it. If your individual
inputs
need to be over 6 digits of precision, you need to pass them as a string ("1234567").

--
General Barron
04:20, 14 November 2009 (CET)