OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Resources Beta Testing & Submission => Topic started by: Spooner on 07 Nov 2007, 17:51:00

Title: SPON_formatNumber v0.1.0 (ACCEPTED)
Post by: Spooner on 07 Nov 2007, 17:51:00
SPON_formatNumber v0.1.0
- Released: 2007-11-07
- SQF function in a single file
- Includes dialog-based test mission.

Description
Formats a number to a minimum integer width (e.g. 56 with 3 width would be "056") and/or to a specific number of decimal places (including padding with 0s and correct rounding). Numbers are always displayed fully, never being condensed using an exponent (e.g. the number 1.234e9 would be given as "1234000000").

Additionally, if required, it will separate the integer part of the number with the appropriate localized seperators as, for example, "21,002" or "1,000,000".

Limitations
Although the function works and will display the passed number correctly, due to the extremely limited accuracy of floating point values used within ArmA (presumably just single-precision / 32 bit), the output might not be as expected after about eight significant figures. Not my fault :whistle:

Get SPON_formatNumber (http://www.ofpec.com/ed_depot/index.php?action=details&id=580)
Title: Re: SPON_formatNumber (READY)
Post by: LeeHunt on 12 Nov 2007, 00:48:05
i'll take a look at this...
Title: Re: SPON_formatNumber (READY)
Post by: JasonO on 12 Nov 2007, 22:04:35
This should be helpful in a timer script I have.

No more 1:3 (1 minute, 3 seconds instead of 1:03) timers!