2015-04-06 18:47:11 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Converts a number to a string without losing as much precission as str or format.
|
|
|
|
*
|
2015-09-17 16:25:02 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: A number <NUMBER>
|
2015-04-06 18:47:11 +00:00
|
|
|
*
|
2015-09-17 16:25:02 +00:00
|
|
|
* Return Value:
|
2015-09-18 19:46:21 +00:00
|
|
|
* The number as string <STRING>
|
2015-09-17 16:25:02 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
2015-04-06 18:47:11 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-17 16:25:02 +00:00
|
|
|
params ["_number"];
|
2015-04-06 18:47:11 +00:00
|
|
|
|
2015-09-17 16:25:02 +00:00
|
|
|
private "_decimals";
|
|
|
|
_decimals = str (abs _number mod 1);
|
2015-04-06 18:47:11 +00:00
|
|
|
_decimals = toArray _decimals;
|
2015-04-06 19:12:38 +00:00
|
|
|
_decimals deleteAt 0;
|
2015-04-06 18:47:11 +00:00
|
|
|
|
2015-04-06 19:12:38 +00:00
|
|
|
if (_number < 0) exitWith {
|
2015-09-17 16:25:02 +00:00
|
|
|
format ["-%1%2", floor abs _number, toString _decimals];
|
2015-04-06 19:12:38 +00:00
|
|
|
};
|
|
|
|
format ["%1%2", floor _number, toString _decimals];
|