Skip to content

"Numbers to expressions" incorrect for small numbers #882

@PFPF

Description

@PFPF

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

  1. const epsilon = 1e-13; if(0 < epsilon) alert("math works!");
  2. Obfuscate with "numbers to expressions" option on
  3. Math doesn't work :(

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:

  1. For any number x, extract its integer and decimal part
  2. Obfuscate the integer part as what you would do
  3. Generate a random integer n between 100 and 100000, and obfuscate the decimal part d as [result of d * n] / n (maybe even obfuscate n as what you would do)
  4. add 'em up

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions