question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Numbers to expressions" incorrect for small numbers

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
sanex3339commented, Feb 19, 2021

No, i haven’t fixed anything yet. Right now i’m thinking about the solution but looks like the easiest way is to convert only integer numbers

0reactions
BlackYuziacommented, Feb 25, 2021

image То чувство когда случайно включил гуглпереводчик. Но он сделал все только прекраснее.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Replace very small numbers by zero in the expression [closed]
When I calculate derivative of expression which is function of x,y really small number appear in my answer. Is there any way to...
Read more >
Translating Word Problems: Examples - Purplemath
Demonstrates how to translate word problems from English sentences into mathematical equations.
Read more >
Numerical Forms & Examples | What is a Numerical Expression?
A numerical expression is a combination of numbers and mathematical operations such as addition, subtraction, multiplication or division. Be ...
Read more >
Rules of Exponents
Simplify and solve expressions in exponential notation. ... The other part of the notation is a small number written in superscript to the...
Read more >
Number Expressions | Engineering Writing Center
Here are some of the most common issues writers have with number expressions in technical documents.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found