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 5 \cdot 10^{+293}:\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot t_1, 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
(let* ((t_1 (- (tanh (/ t y)) (tanh (/ x y)))))
(if (<= (+ x (* (* y z) t_1)) 5e+293)
(fma z (* y t_1) 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 t_1 = tanh((t / y)) - tanh((x / y));
double tmp;
if ((x + ((y * z) * t_1)) <= 5e+293) {
tmp = fma(z, (y * t_1), 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)
t_1 = Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))
tmp = 0.0
if (Float64(x + Float64(Float64(y * z) * t_1)) <= 5e+293)
tmp = fma(z, Float64(y * t_1), 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_] := 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], 5e+293], N[(z * N[(y * t$95$1), $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}
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 5 \cdot 10^{+293}:\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot t_1, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 96.0% Cost 27332
\[\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 5 \cdot 10^{+293}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\]
Alternative 2 Accuracy 83.8% Cost 13972
\[\begin{array}{l}
t_1 := x + z \cdot \left(t - x\right)\\
t_2 := x + \left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right)\\
t_3 := \mathsf{fma}\left(z, y \cdot \left(-\tanh \left(\frac{x}{y}\right)\right), x\right)\\
\mathbf{if}\;t \leq -1.15 \cdot 10^{+43}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -4 \cdot 10^{-19}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1 \cdot 10^{-122}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq -1.5 \cdot 10^{-143}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{-110}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 3 Accuracy 85.5% Cost 7504
\[\begin{array}{l}
t_1 := x + \left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right)\\
t_2 := x + z \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+144}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.12 \cdot 10^{-173}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-231}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+147}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 4 Accuracy 75.9% Cost 713
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.66 \cdot 10^{+38} \lor \neg \left(y \leq 4.6 \cdot 10^{+82}\right):\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 5 Accuracy 71.9% Cost 585
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.82 \cdot 10^{+59} \lor \neg \left(y \leq 3.2 \cdot 10^{+102}\right):\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 6 Accuracy 64.9% Cost 456
\[\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-267}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{-299}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 7 Accuracy 64.5% Cost 64
\[x
\]