Home   Help Search Login Register  

Author Topic: SPON_formatNumber v0.1.0 (ACCEPTED)  (Read 3717 times)

0 Members and 1 Guest are viewing this topic.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
SPON_formatNumber v0.1.0 (ACCEPTED)
« 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
« Last Edit: 12 Dec 2008, 12:31:56 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: SPON_formatNumber (READY)
« Reply #1 on: 12 Nov 2007, 00:48:05 »
i'll take a look at this...

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: SPON_formatNumber (READY)
« Reply #2 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!