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 Error 0.9 Cost 41032
\[\begin{array}{l}
t_1 := x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(z \cdot y\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{+302}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot t - z \cdot x\\
\end{array}
\]
Alternative 2 Error 8.2 Cost 13769
\[\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-23} \lor \neg \left(x \leq 1.5 \cdot 10^{-43}\right):\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \left(-\tanh \left(\frac{x}{y}\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot \tanh \left(\frac{t}{y}\right), x \cdot \left(1 - z\right)\right)\\
\end{array}
\]
Alternative 3 Error 9.9 Cost 13576
\[\begin{array}{l}
t_1 := \tanh \left(\frac{x}{y}\right)\\
t_2 := \tanh \left(\frac{t}{y}\right)\\
t_3 := x + y \cdot \left(z \cdot t_2\right)\\
\mathbf{if}\;t \leq -0.031:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq -2.2 \cdot 10^{-109}:\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \left(-t_1\right), x\right)\\
\mathbf{elif}\;t \leq -5.4 \cdot 10^{-117}:\\
\;\;\;\;x + \left(z \cdot y\right) \cdot \left(t_2 - \frac{x}{y}\right)\\
\mathbf{elif}\;t \leq 2.05 \cdot 10^{-69}:\\
\;\;\;\;x + \left(z \cdot y\right) \cdot \left(\frac{t}{y} - t_1\right)\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 4 Error 9.1 Cost 7497
\[\begin{array}{l}
\mathbf{if}\;t \leq -1.42 \cdot 10^{-92} \lor \neg \left(t \leq 7.2 \cdot 10^{-66}\right):\\
\;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(z \cdot y\right) \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\\
\end{array}
\]
Alternative 5 Error 11.1 Cost 7241
\[\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{-235} \lor \neg \left(t \leq 1.75 \cdot 10^{-223}\right):\\
\;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\]
Alternative 6 Error 20.2 Cost 848
\[\begin{array}{l}
t_1 := x + z \cdot t\\
\mathbf{if}\;t \leq -8600:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.4 \cdot 10^{-235}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 6.5 \cdot 10^{-232}:\\
\;\;\;\;x - z \cdot x\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{-40}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 7 Error 22.9 Cost 717
\[\begin{array}{l}
\mathbf{if}\;z \leq -7.6 \cdot 10^{+199} \lor \neg \left(z \leq 7.2 \cdot 10^{+130}\right) \land z \leq 8.6 \cdot 10^{+193}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 8 Error 15.7 Cost 713
\[\begin{array}{l}
\mathbf{if}\;y \leq -8.8 \cdot 10^{-7} \lor \neg \left(y \leq 7.5 \cdot 10^{+137}\right):\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 9 Error 15.7 Cost 712
\[\begin{array}{l}
\mathbf{if}\;y \leq -8.8 \cdot 10^{-7}:\\
\;\;\;\;x + \left(z \cdot t - z \cdot x\right)\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{+136}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\]
Alternative 10 Error 20.5 Cost 584
\[\begin{array}{l}
\mathbf{if}\;t \leq -1900:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{-37}:\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 11 Error 22.1 Cost 456
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{-262}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-190}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 12 Error 22.2 Cost 64
\[x
\]