diff --git a/tests/math/math_nolibc.go b/tests/math/math_nolibc.go new file mode 100644 index 0000000000..9fee16acc9 --- /dev/null +++ b/tests/math/math_nolibc.go @@ -0,0 +1,27 @@ +//go:build nolibc + +package math_test + +//go:export exp +func exp(f float64) float64 { + return mathExp(f) +} + +//go:linkname mathExp math.exp +func mathExp(float64) float64 + +//go:export exp2 +func exp2(f float64) float64 { + return mathExp(f) +} + +//go:linkname mathExp2 math.exp2 +func mathExp2(float64) float64 + +//go:export log +func log(f float64) float64 { + return mathLog(f) +} + +//go:linkname mathLog math.log +func mathLog(float64) float64 diff --git a/tests/math/math_bench_test.go b/tests/math/math_test.go similarity index 97% rename from tests/math/math_bench_test.go rename to tests/math/math_test.go index 880847cbfc..0606b89def 100644 --- a/tests/math/math_bench_test.go +++ b/tests/math/math_test.go @@ -1,11 +1,10 @@ -// //go:build tinygo.wasm - package math_test import ( "math" "math/rand" "testing" + _ "unsafe" ) var tested float64 @@ -33,6 +32,7 @@ func BenchmarkMathCeil(b *testing.B) { } tested = f } + func BenchmarkMathExp(b *testing.B) { var f float64 for i := 0; i < b.N; i++ {