Commit 3a7e10d7
3a7e10d72e45Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · ~3 modified
Description
Merge pull request #301 from OriPekelman/feat/math-hyperbolic-tanh
feat(codegen): Math.{sinh,cosh,tanh,asinh,acosh,atanh}
Details
- Commit
- 3a7e10d72e45
- Parent
- 4c3d2e30a19e
- Merge parent
- 500653501c22
spinel_codegen.rbmodifiedView file
@@ -4031,6 +4031,17 @@
40314031
if mname == "acos" || mname == "asin" || mname == "atan"40324032
return "float"40334033
end4034+
# Hyperbolic + inverse hyperbolic — same C99 libm wrappers as the4035+
# circular ones above. Issue: returning "float" here lets call sites4036+
# that lift `Math.tanh(x)` into a non-Float context (e.g. into an4037+
# IntArray slot via `arr[i] = Math.tanh(x)`) get caught at type-4038+
# check time instead of silently emitting `0`.4039+
if mname == "sinh" || mname == "cosh" || mname == "tanh"4040+
return "float"4041+
end4042+
if mname == "asinh" || mname == "acosh" || mname == "atanh"4043+
return "float"4044+
end40344045
if mname == "log"40354046
return "float"40364047
end@@ -22945,6 +22956,24 @@
2294522956
if mname == "atan"2294622957
return "atan(" + compile_arg0(nid) + ")"2294722958
end22959+
if mname == "sinh"22960+
return "sinh(" + compile_arg0(nid) + ")"22961+
end22962+
if mname == "cosh"22963+
return "cosh(" + compile_arg0(nid) + ")"22964+
end22965+
if mname == "tanh"22966+
return "tanh(" + compile_arg0(nid) + ")"22967+
end22968+
if mname == "asinh"22969+
return "asinh(" + compile_arg0(nid) + ")"22970+
end22971+
if mname == "acosh"22972+
return "acosh(" + compile_arg0(nid) + ")"22973+
end22974+
if mname == "atanh"22975+
return "atanh(" + compile_arg0(nid) + ")"22976+
end2294822977
if mname == "log"2294922978
return "log(" + compile_arg0(nid) + ")"2295022979
endtest/math.rbmodifiedView file
Loading diff…
test/math.rb.expectedmodifiedView file
Loading diff…