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}
t_1 := \tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\\
\mathbf{if}\;x + \left(y \cdot z\right) \cdot t_1 \leq 10^{+301}:\\
\;\;\;\;x + z \cdot \left(y \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, -x, z \cdot t\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
(let* ((t_1 (- (tanh (/ t y)) (tanh (/ x y)))))
(if (<= (+ x (* (* y z) t_1)) 1e+301)
(+ x (* z (* y t_1)))
(fma z (- x) (* z t))))) 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 t_1 = tanh((t / y)) - tanh((x / y));
double tmp;
if ((x + ((y * z) * t_1)) <= 1e+301) {
tmp = x + (z * (y * t_1));
} else {
tmp = fma(z, -x, (z * t));
}
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)
t_1 = Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))
tmp = 0.0
if (Float64(x + Float64(Float64(y * z) * t_1)) <= 1e+301)
tmp = Float64(x + Float64(z * Float64(y * t_1)));
else
tmp = fma(z, Float64(-x), Float64(z * t));
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_] := Block[{t$95$1 = N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x + N[(N[(y * z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], 1e+301], N[(x + N[(z * N[(y * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * (-x) + N[(z * t), $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}
t_1 := \tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\\
\mathbf{if}\;x + \left(y \cdot z\right) \cdot t_1 \leq 10^{+301}:\\
\;\;\;\;x + z \cdot \left(y \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, -x, z \cdot t\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 98.3% Cost 41032
\[\begin{array}{l}
t_1 := x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\mathbf{elif}\;t_1 \leq 10^{+301}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, -x, z \cdot t\right)\\
\end{array}
\]
Alternative 2 Accuracy 87.7% Cost 13576
\[\begin{array}{l}
t_1 := \tanh \left(\frac{x}{y}\right)\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{-20}:\\
\;\;\;\;x - z \cdot \left(y \cdot t_1\right)\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-9}:\\
\;\;\;\;x + z \cdot \left(y \cdot \tanh \left(\frac{t}{y}\right) - x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot \left(-t_1\right), x\right)\\
\end{array}
\]
Alternative 3 Accuracy 74.2% Cost 7636
\[\begin{array}{l}
t_1 := x + z \cdot \left(t - x\right)\\
t_2 := x - z \cdot \left(y \cdot \tanh \left(\frac{x}{y}\right)\right)\\
t_3 := \left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;x \leq -3.3 \cdot 10^{-23}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{-186}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-267}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-195}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-128}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 4 Accuracy 68.5% Cost 7508
\[\begin{array}{l}
t_1 := \left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right)\\
t_2 := x + z \cdot \left(t - x\right)\\
\mathbf{if}\;x \leq -8.6 \cdot 10^{+69}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-187}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-268}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-198}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-129}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 5 Accuracy 87.7% Cost 7369
\[\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-20} \lor \neg \left(x \leq 6.6 \cdot 10^{-11}\right):\\
\;\;\;\;x - z \cdot \left(y \cdot \tanh \left(\frac{x}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot \tanh \left(\frac{t}{y}\right) - x\right)\\
\end{array}
\]
Alternative 6 Accuracy 70.5% Cost 980
\[\begin{array}{l}
t_1 := x + z \cdot t\\
\mathbf{if}\;y \leq -0.9:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-33}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+110}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+149}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+263}:\\
\;\;\;\;x - x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 7 Accuracy 75.6% Cost 976
\[\begin{array}{l}
t_1 := x + z \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{-34}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+111}:\\
\;\;\;\;x + z \cdot t\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+146}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 8 Accuracy 63.2% Cost 849
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-42}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-259} \lor \neg \left(x \leq 1.06 \cdot 10^{-218}\right) \land x \leq 1.6 \cdot 10^{-176}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 9 Accuracy 68.3% Cost 584
\[\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 6.6:\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 10 Accuracy 65.1% Cost 456
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-156}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-259}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 11 Accuracy 65.4% Cost 64
\[x
\]