JPEXS Free Flash Decompiler Issue Tracker

If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler

NEW : We have got a new blog where we post some interesting SWF internals info.

List of issuesList of issues

#2089 big integer in actionscript
Author: user NEMAMENE
Date created:
Type: question
Visibility: Everybody
Assigned to:
State: opened Help

When trying to use large integers in AS, I noticed that the decompiler truncates them and breaks the whole code accordingly. When writing code: var hash:int = 14695981039346656037; After saving: var hash:int = 14695981039346655000; I understand that, most likely, the problem is that int is not capable of storing a number of this size and, accordingly, the decompiler tries to fix it itself... Is there any way to assign numbers of such large sizes? I have tried using "uint", "Number" but the result is always the same...
user
my first guess would've been floating point numbers, but the steps are really odd. with a number that big, it seems to either round up or down to two thousand/three thousand maximum. Reducing the number's length by 1 seems to make the number shift to places that are either 250 or 260 in difference to the previous step. Maybe the code handles numbers this big with a combination of floating points and rounding?
admin
Maximum count of significant digits in a double precision value is 17 digits, if you add more digits, they will be rounded. If you want to do processing with more significant digits, you need to store numbers in Strings and use for example some Big number processing library. I think you need something like this: https://github.com/Atmosphere/ActionScript/blob/master/src/com/hurlant/math/BigInteger.as
State: new→opened
user
Yeah, I have already met with the BigInteger library, but unfortunately I never managed to import it into my own .gfx file. The library requires imports of many other additional libraries, and besides, when trying to save it in the decompiler, it gives many errors...
user
I came up with a way to split my integer into an array in hex representation. Thanks for the answers.