ID:2273154
 
Not a bug
BYOND Version:511
Operating System:Windows 10 Home 64-bit
Web Browser:Chrome 59.0.3071.115
Applies to:Dream Seeker
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:
Regex is returning inaccurate/weird numbers.

Numbered Steps to Reproduce Problem:
code below

Code Snippet (if applicable) to Reproduce Problem:
var/regex/comma_expression = new("(\\d)(?=(\\d{3})+$)","g")
#define commafy(x) comma_expression.Replace(num2text(x,12),"$&,")

(code by Nadrew)

Expected Results:
commafy(99999999) should return 99,999,999
commafy(999999951) should return 999,999,951
commafy(999999926) should return 999,999,926
commafy(99999918) should return 99,999,918

Actual Results:
commafy(99999999) returns 100,000,000
commafy(999999951) returns 999,999,936
commafy(999999926) returns 999,999,936
commafy(99999918) returns 99,999,920

Does the problem occur:
Every time? Or how often?
only on numbers with more than 7 sigfigs
In other games?
all my projects
In other user accounts?
On other computers?

When does the problem NOT occur?
when using numbers with 7 or less sigfigs

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Workarounds:

nothing to do with regex.

it's an issue with number precision & num2text. the DM VM only is accurate up to 2^24 (which is 16777216).

    test()
var n = 16777217
world << num2text(n, 12)


this will output 16777216. anything higher will output a number *around* that number
Well damn, that blows. Someone can delete this issue I guess. :|
Lummox JR resolved issue (Not a bug)
My pif_LongInt library will mitigate this to some extent. It has support for signed and unsigned 32 bit integers (I plan to add signed and unsigned 48 and 64 bit ints when I stop being lazy and do some programming again).
In response to Popisfizzy
I found it a few hours after I posted this. :)
Oh my god.

Someone is using one of my libraries.