Math FPCore C Julia Wolfram TeX \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\]
↓
\[\mathsf{fma}\left(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)
\]
(FPCore (x y z t)
:precision binary64
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))) ↓
(FPCore (x y z t)
:precision binary64
(fma z (* y (- (tanh (/ t y)) (tanh (/ x y)))) x)) double code(double x, double y, double z, double t) {
return x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
}
↓
double code(double x, double y, double z, double t) {
return fma(z, (y * (tanh((t / y)) - tanh((x / y)))), x);
}
function code(x, y, z, t)
return Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))))
end
↓
function code(x, y, z, t)
return fma(z, Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), x)
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_, t_] := N[(z * N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
↓
\mathsf{fma}\left(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)
Alternatives Alternative 1 Error 3.5% Cost 27332
\[\begin{array}{l}
t_1 := x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(z \cdot y\right)\\
\mathbf{if}\;t_1 \leq 10^{+307}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\]
Alternative 2 Error 11.59% Cost 13769
\[\begin{array}{l}
\mathbf{if}\;t \leq -1.15 \cdot 10^{-48} \lor \neg \left(t \leq 88000000000000\right):\\
\;\;\;\;x + z \cdot \frac{1}{\frac{1}{y \cdot \tanh \left(\frac{t}{y}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right), x\right)\\
\end{array}
\]
Alternative 3 Error 13.74% Cost 13576
\[\begin{array}{l}
t_1 := \tanh \left(\frac{x}{y}\right)\\
\mathbf{if}\;x \leq -100:\\
\;\;\;\;x - z \cdot \left(y \cdot t_1\right)\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-67}:\\
\;\;\;\;x + z \cdot \frac{1}{\frac{1}{y \cdot \tanh \left(\frac{t}{y}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot \left(-t_1\right), x\right)\\
\end{array}
\]
Alternative 4 Error 13.74% Cost 7497
\[\begin{array}{l}
\mathbf{if}\;x \leq -18 \lor \neg \left(x \leq 6.5 \cdot 10^{-68}\right):\\
\;\;\;\;x - z \cdot \left(y \cdot \tanh \left(\frac{x}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{1}{\frac{1}{y \cdot \tanh \left(\frac{t}{y}\right)}}\\
\end{array}
\]
Alternative 5 Error 15.68% Cost 7369
\[\begin{array}{l}
\mathbf{if}\;x \leq -29 \lor \neg \left(x \leq 4.2 \cdot 10^{-67}\right):\\
\;\;\;\;x - z \cdot \left(y \cdot \tanh \left(\frac{x}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{\frac{1}{\tanh \left(\frac{t}{y}\right)}}\\
\end{array}
\]
Alternative 6 Error 15.58% Cost 7241
\[\begin{array}{l}
\mathbf{if}\;x \leq -32 \lor \neg \left(x \leq 6.2 \cdot 10^{-67}\right):\\
\;\;\;\;x - z \cdot \left(y \cdot \tanh \left(\frac{x}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(z \cdot y\right)\\
\end{array}
\]
Alternative 7 Error 21.83% Cost 7112
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+97}:\\
\;\;\;\;x + \frac{t + x}{\frac{\frac{t + x}{z}}{t - x}}\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+124}:\\
\;\;\;\;x + \frac{z \cdot y}{\frac{t}{y} \cdot 0.3333333333333333 + \frac{y}{t}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, z, x - z \cdot x\right)\\
\end{array}
\]
Alternative 8 Error 18.09% Cost 7108
\[\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+98}:\\
\;\;\;\;x + \frac{t + x}{\frac{\frac{t + x}{z}}{t - x}}\\
\mathbf{else}:\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(z \cdot y\right)\\
\end{array}
\]
Alternative 9 Error 20.93% Cost 1224
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.42 \cdot 10^{+97}:\\
\;\;\;\;x \cdot \left(1 - z\right) + z \cdot t\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+127}:\\
\;\;\;\;x + \frac{z \cdot y}{\frac{t}{y} \cdot 0.3333333333333333 + \frac{y}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\]
Alternative 10 Error 21.84% Cost 1224
\[\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+97}:\\
\;\;\;\;x + \frac{t + x}{\frac{\frac{t + x}{z}}{t - x}}\\
\mathbf{elif}\;y \leq 7.9 \cdot 10^{+121}:\\
\;\;\;\;x + \frac{z \cdot y}{\frac{t}{y} \cdot 0.3333333333333333 + \frac{y}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\]
Alternative 11 Error 22.46% Cost 713
\[\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+62} \lor \neg \left(y \leq 220\right):\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 12 Error 22.41% Cost 712
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+56}:\\
\;\;\;\;x \cdot \left(1 - z\right) + z \cdot t\\
\mathbf{elif}\;y \leq 85:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\]
Alternative 13 Error 27.32% Cost 585
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+64} \lor \neg \left(y \leq 82\right):\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 14 Error 34.43% Cost 64
\[x
\]