projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4d21868
)
[libc][NFC] Fix conversion warning
author
Alex Brachet
<abrachet@google.com>
Tue, 28 Mar 2023 20:24:20 +0000
(20:24 +0000)
committer
Alex Brachet
<abrachet@google.com>
Tue, 28 Mar 2023 20:24:20 +0000
(20:24 +0000)
libc/src/math/generic/tanhf.cpp
patch
|
blob
|
history
diff --git
a/libc/src/math/generic/tanhf.cpp
b/libc/src/math/generic/tanhf.cpp
index
3b8506f
..
8f2ba88
100644
(file)
--- a/
libc/src/math/generic/tanhf.cpp
+++ b/
libc/src/math/generic/tanhf.cpp
@@
-61,8
+61,8
@@
LLVM_LIBC_FUNCTION(float, tanhf, (float x)) {
double r = ExpBase::powb_lo(ep.lo);
// tanh(x) = (exp(2x) - 1) / (exp(2x) + 1)
#if defined(LIBC_TARGET_CPU_HAS_FMA)
- return fputil::multiply_add(ep.mh, r, -1.0) /
-
fputil::multiply_add(ep.mh, r, 1.0
);
+ return
static_cast<float>(
fputil::multiply_add(ep.mh, r, -1.0) /
+
fputil::multiply_add(ep.mh, r, 1.0)
);
#else
double exp_x = ep.mh * r;
return static_cast<float>((exp_x - 1.0) / (exp_x + 1.0));