From b74baf1f684f19cd430c648aacfa99b46b1b0961 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Mar 2020 21:37:49 +0100 Subject: [PATCH 1/2] fix CBA_fnc_formatNumber for small negative numbers --- addons/strings/fnc_formatNumber.sqf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/strings/fnc_formatNumber.sqf b/addons/strings/fnc_formatNumber.sqf index 30dc223be..adf9f87d1 100644 --- a/addons/strings/fnc_formatNumber.sqf +++ b/addons/strings/fnc_formatNumber.sqf @@ -86,6 +86,9 @@ if (_separateThousands) then { // add localized thousands seperator "1,000" }; }; -if (_isNegative) then {_return = "-" + _return;}; // re-add negative sign +// re-add negative sign if there is at least one decimal place != 0. +if (_isNegative && {!(toArray _return arrayIntersect toArray "123456789" isEqualTo [])}) then { + _return = "-" + _return; +}; _return From 3ce962b8ab58a8af2fc44ad8b066ba76621e6ce7 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Mar 2020 21:38:23 +0100 Subject: [PATCH 2/2] fix CBA_fnc_formatNumber for small negative numbers --- addons/strings/fnc_formatNumber.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/strings/fnc_formatNumber.sqf b/addons/strings/fnc_formatNumber.sqf index adf9f87d1..5ec4187ef 100644 --- a/addons/strings/fnc_formatNumber.sqf +++ b/addons/strings/fnc_formatNumber.sqf @@ -86,7 +86,7 @@ if (_separateThousands) then { // add localized thousands seperator "1,000" }; }; -// re-add negative sign if there is at least one decimal place != 0. +// Re-add negative sign if there is at least one decimal place != 0. if (_isNegative && {!(toArray _return arrayIntersect toArray "123456789" isEqualTo [])}) then { _return = "-" + _return; };