Skip to content

implemented more math function and value conversions - #450

Merged
tomblind merged 2 commits into
masterfrom
math-update
Feb 25, 2019
Merged

implemented more math function and value conversions#450
tomblind merged 2 commits into
masterfrom
math-update

Conversation

@tomblind

Copy link
Copy Markdown
Collaborator

fixes #438

Since I had to restructure things a bit for Math.round, I went ahead and implemented some of the other low-hanging-fruit math function conversions.

Comment thread src/LuaTransformer.ts
Comment thread src/LuaTransformer.ts Outdated
case "LOG2E":
case "SQRT1_2":
case "SQRT2":
return tstl.createNumericLiteral(Math[name]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add the original TS node here

Comment thread test/unit/math.spec.ts
@@ -8,7 +8,13 @@ export class MathTests {
@TestCase("Math.cos()", "math.cos();")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test for constants (probably would be nice to actually util.transpileAndExecute those)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are tests for Math.PI and Math.E. Should I add a test for every one?

Also, I'm not sure we should do execute tests since there could be inconsistencies with precision.

@tomblind
tomblind merged commit d8a1898 into master Feb 25, 2019
@tomblind
tomblind deleted the math-update branch February 25, 2019 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Math.round isn't transpiled properly

2 participants