Skip to content

Commit dd65c22

Browse files
committed
compiler/natives/src/math: Implement missing functions.
This change makes all math tests pass. Fixes: $ gopherjs test --short math --- FAIL: TestAcosh (0.00s) Error: runtime error: native function not implemented: math.Acosh
1 parent b9c0354 commit dd65c22

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

compiler/natives/src/math/math.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,34 @@ func Acos(x float64) float64 {
1616
return math.Call("acos", x).Float()
1717
}
1818

19+
func Acosh(x float64) float64 {
20+
return math.Call("acosh", x).Float()
21+
}
22+
1923
func Asin(x float64) float64 {
2024
return math.Call("asin", x).Float()
2125
}
2226

27+
func Asinh(x float64) float64 {
28+
return math.Call("asinh", x).Float()
29+
}
30+
2331
func Atan(x float64) float64 {
2432
return math.Call("atan", x).Float()
2533
}
2634

35+
func Atanh(x float64) float64 {
36+
return math.Call("atanh", x).Float()
37+
}
38+
2739
func Atan2(y, x float64) float64 {
2840
return math.Call("atan2", y, x).Float()
2941
}
3042

43+
func Cbrt(x float64) float64 {
44+
return math.Call("cbrt", x).Float()
45+
}
46+
3147
func Ceil(x float64) float64 {
3248
return math.Call("ceil", x).Float()
3349
}
@@ -51,6 +67,14 @@ func Dim(x, y float64) float64 {
5167
return dim(x, y)
5268
}
5369

70+
func Erf(x float64) float64 {
71+
return erf(x)
72+
}
73+
74+
func Erfc(x float64) float64 {
75+
return erfc(x)
76+
}
77+
5478
func Exp(x float64) float64 {
5579
return math.Call("exp", x).Float()
5680
}

0 commit comments

Comments
 (0)