Skip to content

Math calculations don't minify properly #45

@Haizlbliek

Description

@Haizlbliek

If a variable is used inside a math calculation, the whole calculation is not minified.
It probably has something to do with the parenthesis.

Example 1

?(1 * (1 * (1 * (1 * (1 * (1 * (1 * (1 * (x * 1)))))))))

This doesn't get minified, as it has the variable.
However, turning x into a 1 makes the minified result ?1

Expected Result

?x

Actual Result

?1*(1*(1*(1*(1*(1*(1*(1*(a*1))))))))

Example 2

?(1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (x + 1)))))))))

This gives the same type of result.

Expected Result

?x+9

Actual Result

?1+(1+(1+(1+(1+(1+(1+(1+(a+1))))))))

Example 3

x = (9 * (2 * y)) * 4

Taking out the parenthesis fixes this problem (Example 4)

Expected Result

x = 72 * y

Actual Result

a=9*(2*b)*4

Example 4

x = 9 * 2 * y * 4

While this fixes the minification problem, it causes a new one: The left and right half are merged separately.

Expected Result

x = 72 * y

Actual Result

a=18*b*4

Outro

Well, that's what I've found so far. Hope it helps with some minification stuff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions