Skip to content

Commit 11ab3a6

Browse files
MaxGraeydcodeIO
authored andcommitted
Implement sin, cos, tan and sincos for Math (AssemblyScript#806)
1 parent 9203805 commit 11ab3a6

13 files changed

+52211
-34970
lines changed

std/assembly/math.ts

+486-101
Large diffs are not rendered by default.

tests/compiler/mandelbrot.optimized.wat

+2-3
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,16 @@
161161
i32.sub
162162
local.get $5
163163
i32.add
164-
local.tee $1
165164
f64.convert_i32_s
165+
local.tee $0
166166
f64.const 1.9082149292705877e-10
167167
f64.mul
168168
f64.add
169169
local.get $4
170170
f64.sub
171171
local.get $3
172172
f64.add
173-
local.get $1
174-
f64.convert_i32_s
173+
local.get $0
175174
f64.const 0.6931471803691238
176175
f64.mul
177176
f64.add

tests/compiler/mandelbrot.untouched.wat

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
(local $9 f64)
2121
(local $10 f64)
2222
(local $11 f64)
23-
(local $12 i32)
23+
(local $12 f64)
2424
local.get $0
2525
i64.reinterpret_f64
2626
local.set $1
@@ -197,14 +197,14 @@
197197
f64.add
198198
local.set $11
199199
local.get $3
200+
f64.convert_i32_s
200201
local.set $12
201202
local.get $6
202203
local.get $5
203204
local.get $11
204205
f64.add
205206
f64.mul
206207
local.get $12
207-
f64.convert_i32_s
208208
f64.const 1.9082149292705877e-10
209209
f64.mul
210210
f64.add
@@ -213,7 +213,6 @@
213213
local.get $4
214214
f64.add
215215
local.get $12
216-
f64.convert_i32_s
217216
f64.const 0.6931471803691238
218217
f64.mul
219218
f64.add

tests/compiler/std/array.optimized.wat

+2-2
Original file line numberDiff line numberDiff line change
@@ -4188,7 +4188,7 @@
41884188
if
41894189
i32.const 0
41904190
i32.const 3160
4191-
i32.const 1041
4191+
i32.const 1369
41924192
i32.const 4
41934193
call $~lib/builtins/abort
41944194
unreachable
@@ -5724,7 +5724,7 @@
57245724
if
57255725
i32.const 3936
57265726
i32.const 3160
5727-
i32.const 1048
5727+
i32.const 1376
57285728
i32.const 24
57295729
call $~lib/builtins/abort
57305730
unreachable

tests/compiler/std/array.untouched.wat

+2-2
Original file line numberDiff line numberDiff line change
@@ -6574,7 +6574,7 @@
65746574
if
65756575
i32.const 0
65766576
i32.const 3160
6577-
i32.const 1041
6577+
i32.const 1369
65786578
i32.const 4
65796579
call $~lib/builtins/abort
65806580
unreachable
@@ -8865,7 +8865,7 @@
88658865
if
88668866
i32.const 3936
88678867
i32.const 3160
8868-
i32.const 1048
8868+
i32.const 1376
88698869
i32.const 24
88708870
call $~lib/builtins/abort
88718871
unreachable

0 commit comments

Comments
 (0)