fix(codegen): #142 Math.tan/asin/acos/atan/atan2 silent identity (v0.…#148
Open
proggeramlug wants to merge 1 commit intomainfrom
Open
fix(codegen): #142 Math.tan/asin/acos/atan/atan2 silent identity (v0.…#148proggeramlug wants to merge 1 commit intomainfrom
proggeramlug wants to merge 1 commit intomainfrom
Conversation
…5.165) The five codegen arms at crates/perry-codegen/src/expr.rs:5417-5424 fell through to lower_expr(ctx, o), returning the argument unchanged. Runtime functions (js_math_tan/asin/acos/atan/atan2 in perry-runtime/src/math.rs) and extern declarations (runtime_decls.rs:1482-1493) were already present — only the codegen wiring was missing. Replaced the fall-through with calls to the existing runtime symbols, matching the shape of the sinh/cosh/tanh arms three lines above. atan2 evaluates y first then x (JS arg order) and passes both to js_math_atan2. Verified against node --experimental-strip-types: Math.tan(1) = 1.557… (was 1), Math.atan2(0,-1) = π (was -1) — all within last-digit libm rounding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…5.165)
The five codegen arms at crates/perry-codegen/src/expr.rs:5417-5424 fell through to lower_expr(ctx, o), returning the argument unchanged. Runtime functions (js_math_tan/asin/acos/atan/atan2 in perry-runtime/src/math.rs) and extern declarations (runtime_decls.rs:1482-1493) were already present — only the codegen wiring was missing.
Replaced the fall-through with calls to the existing runtime symbols, matching the shape of the sinh/cosh/tanh arms three lines above. atan2 evaluates y first then x (JS arg order) and passes both to js_math_atan2.
Verified against node --experimental-strip-types: Math.tan(1) = 1.557… (was 1), Math.atan2(0,-1) = π (was -1) — all within last-digit libm rounding.
Summary
Changes
Related issue
Test plan
cargo build --releasecleancargo test --workspace --exclude perry-ui-ios --exclude perry-ui-tvos --exclude perry-ui-watchos --exclude perry-ui-gtk4 --exclude perry-ui-android --exclude perry-ui-windowspassestest-files/or a#[test]in the affected cratedocs/src/-p perry-ui-<backend>locally on that platformScreenshots / output
Checklist
feat:/fix:/docs:/chore:prefix convention used in the log