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 5 \cdot 10^{+229}:\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + z \cdot t\right) - z \cdot x\\
\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 5e+229)
(fma z (* y (- (tanh (/ t y)) (tanh (/ x y)))) x)
(- (+ x (* z t)) (* z 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 <= 5e+229) {
tmp = fma(z, (y * (tanh((t / y)) - tanh((x / y)))), x);
} else {
tmp = (x + (z * t)) - (z * 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 <= 5e+229)
tmp = fma(z, Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), x);
else
tmp = Float64(Float64(x + Float64(z * t)) - Float64(z * 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, 5e+229], N[(z * N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(z * x), $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 5 \cdot 10^{+229}:\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + z \cdot t\right) - z \cdot x\\
\end{array}
Alternatives Alternative 1 Error 11.8 Cost 14428
\[\begin{array}{l}
t_1 := x + \left(y \cdot z\right) \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\\
t_2 := \tanh \left(\frac{t}{y}\right) - \frac{x}{y}\\
t_3 := \mathsf{fma}\left(z, y \cdot t_2, x\right)\\
\mathbf{if}\;y \leq -4.978469123197317 \cdot 10^{+21}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq -5.265108367908785 \cdot 10^{-30}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -8.954599301357871 \cdot 10^{-32}:\\
\;\;\;\;x + t_2 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;y \leq 9.801310009497872 \cdot 10^{-102}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 10^{+120}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq 10^{+160}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 10^{+218}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\left(x + z \cdot t\right) - z \cdot x\\
\end{array}
\]
Alternative 2 Error 1.6 Cost 13764
\[\begin{array}{l}
\mathbf{if}\;y \leq 5 \cdot 10^{+229}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + z \cdot t\right) - z \cdot x\\
\end{array}
\]
Alternative 3 Error 12.6 Cost 8024
\[\begin{array}{l}
t_1 := x + \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{if}\;y \leq -1 \cdot 10^{+169}:\\
\;\;\;\;x + \frac{t - x}{\frac{1}{z}}\\
\mathbf{elif}\;y \leq -4.978469123197317 \cdot 10^{+21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -5.265108367908785 \cdot 10^{-30}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\\
\mathbf{elif}\;y \leq -8.954599301357871 \cdot 10^{-32}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 9.801310009497872 \cdot 10^{-102}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.722799083554523 \cdot 10^{+68}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(x + z \cdot t\right) - z \cdot x\\
\end{array}
\]
Alternative 4 Error 12.5 Cost 7760
\[\begin{array}{l}
t_1 := x + \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{if}\;y \leq -1 \cdot 10^{+169}:\\
\;\;\;\;x + \frac{t - x}{\frac{1}{z}}\\
\mathbf{elif}\;y \leq -8.954599301357871 \cdot 10^{-32}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 9.801310009497872 \cdot 10^{-102}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.722799083554523 \cdot 10^{+68}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(x + z \cdot t\right) - z \cdot x\\
\end{array}
\]
Alternative 5 Error 14.8 Cost 840
\[\begin{array}{l}
t_1 := x + \frac{t - x}{\frac{1}{z}}\\
\mathbf{if}\;y \leq -4.978469123197317 \cdot 10^{+21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.600611217249082 \cdot 10^{+64}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 6 Error 14.8 Cost 840
\[\begin{array}{l}
\mathbf{if}\;y \leq -4.978469123197317 \cdot 10^{+21}:\\
\;\;\;\;x + \frac{t - x}{\frac{1}{z}}\\
\mathbf{elif}\;y \leq 2.600611217249082 \cdot 10^{+64}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{1}{t - x}}\\
\end{array}
\]
Alternative 7 Error 14.7 Cost 840
\[\begin{array}{l}
t_1 := \left(x + z \cdot t\right) - z \cdot x\\
\mathbf{if}\;y \leq -4.978469123197317 \cdot 10^{+21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.600611217249082 \cdot 10^{+64}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 8 Error 17.7 Cost 584
\[\begin{array}{l}
t_1 := x + z \cdot t\\
\mathbf{if}\;y \leq -4.978469123197317 \cdot 10^{+21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.600611217249082 \cdot 10^{+64}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 9 Error 22.2 Cost 456
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.70853812750078 \cdot 10^{-238}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.325025159969309 \cdot 10^{-222}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 10 Error 22.6 Cost 64
\[x
\]