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 Accuracy 97.3% Cost 19904
\[\mathsf{fma}\left(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)
\]
Alternative 2 Accuracy 96.4% Cost 13632
\[x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)
\]
Alternative 3 Accuracy 88.9% Cost 13513
\[\begin{array}{l}
t_1 := y \cdot \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;y \leq -6.2 \cdot 10^{+17} \lor \neg \left(y \leq 61\right):\\
\;\;\;\;x + z \cdot \left(t_1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t_1, x\right)\\
\end{array}
\]
Alternative 4 Accuracy 89.0% Cost 7369
\[\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;y \leq -1.52 \cdot 10^{+16} \lor \neg \left(y \leq 1050\right):\\
\;\;\;\;x + z \cdot \left(y \cdot t_1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t_1 \cdot \left(z \cdot y\right)\\
\end{array}
\]
Alternative 5 Accuracy 86.1% Cost 7240
\[\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+147}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+144}:\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\]
Alternative 6 Accuracy 75.3% Cost 6984
\[\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-38}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{elif}\;y \leq 125:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\]
Alternative 7 Accuracy 65.3% Cost 848
\[\begin{array}{l}
t_1 := z \cdot \left(t - x\right)\\
t_2 := x + z \cdot t\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{+38}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-68}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-192}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{+199}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 8 Accuracy 55.7% Cost 784
\[\begin{array}{l}
t_1 := -z \cdot x\\
\mathbf{if}\;z \leq -9.2 \cdot 10^{+153}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+72}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+163}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+201}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 9 Accuracy 64.5% Cost 717
\[\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+160}:\\
\;\;\;\;x - z \cdot x\\
\mathbf{elif}\;y \leq -1.5 \cdot 10^{-38} \lor \neg \left(y \leq 6.6 \cdot 10^{-74}\right):\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 10 Accuracy 75.3% Cost 713
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{-38} \lor \neg \left(y \leq 60\right):\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 11 Accuracy 64.2% Cost 585
\[\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+30} \lor \neg \left(z \leq 1.45 \cdot 10^{-21}\right):\\
\;\;\;\;z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 12 Accuracy 55.4% Cost 456
\[\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+140}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+70}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\]
Alternative 13 Accuracy 53.1% Cost 64
\[x
\]