Commit ce550d9
committed
fix(codegen): #142 Math.tan/asin/acos/atan/atan2 silent identity (v0.5.177)
Merged via conflict-resolved cherry-pick of PR #148 (original branch cut
at v0.5.164; main had advanced to v0.5.176 so the CLAUDE.md / Cargo.toml
/ Cargo.lock bumps had to be taken from main and reapplied at v0.5.177).
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), Math.asin(1) = π/2, Math.acos(1) = 0,
Math.atan(1) = π/4 — all within last-digit libm rounding.
Original author: Ralph Küpper <ralph.kuepper@skelpo.com> (PR #148).1 parent 4428e6f commit ce550d9
4 files changed
Lines changed: 52 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5412 | 5412 | | |
5413 | 5413 | | |
5414 | 5414 | | |
5415 | | - | |
5416 | | - | |
5417 | | - | |
5418 | | - | |
5419 | | - | |
5420 | | - | |
| 5415 | + | |
| 5416 | + | |
| 5417 | + | |
| 5418 | + | |
| 5419 | + | |
| 5420 | + | |
| 5421 | + | |
| 5422 | + | |
| 5423 | + | |
| 5424 | + | |
| 5425 | + | |
| 5426 | + | |
| 5427 | + | |
| 5428 | + | |
| 5429 | + | |
| 5430 | + | |
5421 | 5431 | | |
5422 | | - | |
5423 | | - | |
| 5432 | + | |
| 5433 | + | |
| 5434 | + | |
| 5435 | + | |
| 5436 | + | |
| 5437 | + | |
| 5438 | + | |
5424 | 5439 | | |
5425 | 5440 | | |
5426 | 5441 | | |
| |||
0 commit comments