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)
\]
↓
\[\begin{array}{l}
\mathbf{if}\;y \leq 2.1 \cdot 10^{+216}:\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\]
(FPCore (x y z t)
:precision binary64
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))) ↓
(FPCore (x y z t)
:precision binary64
(if (<= y 2.1e+216)
(fma z (* y (- (tanh (/ t y)) (tanh (/ x y)))) x)
(+ x (* z (- t 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) {
double tmp;
if (y <= 2.1e+216) {
tmp = fma(z, (y * (tanh((t / y)) - tanh((x / y)))), x);
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
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)
tmp = 0.0
if (y <= 2.1e+216)
tmp = fma(z, Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), x);
else
tmp = Float64(x + Float64(z * Float64(t - x)));
end
return tmp
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_] := If[LessEqual[y, 2.1e+216], N[(z * N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
↓
\begin{array}{l}
\mathbf{if}\;y \leq 2.1 \cdot 10^{+216}:\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 88.8% Cost 13769
\[\begin{array}{l}
\mathbf{if}\;t \leq -800000 \lor \neg \left(t \leq 3 \cdot 10^{-89}\right):\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \tanh \left(\frac{t}{y}\right), x\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 2 Accuracy 97.6% Cost 13764
\[\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{+216}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\]
Alternative 3 Accuracy 86.6% Cost 13644
\[\begin{array}{l}
t_1 := \mathsf{fma}\left(z, y \cdot \tanh \left(\frac{t}{y}\right), x\right)\\
\mathbf{if}\;t \leq -9.8 \cdot 10^{-148}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1.05 \cdot 10^{-235}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{elif}\;t \leq 1.85 \cdot 10^{-87}:\\
\;\;\;\;x + \left(z \cdot t - \tanh \left(\frac{x}{y}\right) \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 4 Accuracy 80.9% Cost 7636
\[\begin{array}{l}
t_1 := x + z \cdot \left(t - x\right)\\
t_2 := x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{if}\;t \leq -3.3 \cdot 10^{-147}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -7.8 \cdot 10^{-236}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1.95 \cdot 10^{-290}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-269}:\\
\;\;\;\;x + \frac{z}{\frac{1}{t - x}}\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{-90}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 5 Accuracy 84.1% Cost 7628
\[\begin{array}{l}
t_1 := x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{if}\;t \leq -5.1 \cdot 10^{-148}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -9.5 \cdot 10^{-236}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{-93}:\\
\;\;\;\;x + \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 6 Accuracy 84.2% Cost 7628
\[\begin{array}{l}
t_1 := x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{if}\;t \leq -6 \cdot 10^{-149}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1.25 \cdot 10^{-235}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{-87}:\\
\;\;\;\;x + \left(z \cdot t - \tanh \left(\frac{x}{y}\right) \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 7 Accuracy 84.2% Cost 7364
\[\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;y \leq -1.65 \cdot 10^{-43}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(t_1 - \frac{x}{y}\right)\right)\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+91}:\\
\;\;\;\;x + t_1 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\]
Alternative 8 Accuracy 74.3% Cost 7244
\[\begin{array}{l}
t_1 := x + z \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-47}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+20}:\\
\;\;\;\;\tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+93}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 9 Accuracy 76.2% Cost 713
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-39} \lor \neg \left(y \leq 1.86 \cdot 10^{+93}\right):\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 10 Accuracy 67.9% Cost 585
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.35 \cdot 10^{-40} \lor \neg \left(y \leq 1.85 \cdot 10^{+93}\right):\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 11 Accuracy 70.7% Cost 584
\[\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{+57}:\\
\;\;\;\;x + z \cdot t\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+93}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\]
Alternative 12 Accuracy 63.2% Cost 520
\[\begin{array}{l}
\mathbf{if}\;z \leq 2.6 \cdot 10^{+29}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+101}:\\
\;\;\;\;z \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 13 Accuracy 64.8% Cost 64
\[x
\]