-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Numbers to expressions" incorrect for small numbers #882
Comments
@sanex3339 did you fix anything in obfuscator.io? Because I try obfuscate this: const epsilon = 1e-13; if(0 < epsilon) alert("math works!"); and I get I use numbers to expression option. UPD: Lol, this is random I think. Now I can't get result "math works". Okey ... this should be a random bug. |
No, i haven't fixed anything yet. |
@BlackYuzia I think "math works!" iff the last randomized term is < 1024 (because 1024 is the smallest number such that @sanex3339 Looking forward to it. What do you think about the method I mentioned? So for 1e-13, you would get something like |
Ok. I will implement @PFPF approach. |
Hmm. As a simple solution, I can disable transformation of all float numbers. |
Oh, I think we should be obfuscating the denominator (integer) not the numerator (decimal). (Sorry if it's unclear) |
PR: |
Thanks for the swift response. Could you confirm that it works with -1e-100? (I made a comment about one line in the code where it uses Math.floor) |
Merged |
Looks good! |
Released as 2.10.4 |
Great. For better obfuscation purpose, I would still suggest having a random, obfuscated integer as the denominator of the decimal part, but the current implementation does fix the issue. Thx for your time on this! |
A little confused that my obfuscated code worked differently than the original code, then I found that it's the "numbers to expressions" misbehaving.
Current Behavior
"Numbers to expressions" option loses accuracy for small numbers, turning them into 0.
Steps to Reproduce
const epsilon = 1e-13; if(0 < epsilon) alert("math works!");
It'll be great if this feature can be made more robust. I haven't looked at the implementation code, but I guess you can do something like the following:
The text was updated successfully, but these errors were encountered: