Math FPCore C Julia Wolfram TeX \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\]
↓
\[x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}
\]
(FPCore (x y z t a b)
:precision binary64
(* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b)))))) ↓
(FPCore (x y z t a b)
:precision binary64
(* x (exp (fma y (- (log z) t) (* a (- (log1p (- z)) b)))))) double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
↓
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(fma(y, (log(z) - t), (a * (log1p(-z) - b))));
}
function code(x, y, z, t, a, b)
return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b)))))
end
↓
function code(x, y, z, t, a, b)
return Float64(x * exp(fma(y, Float64(log(z) - t), Float64(a * Float64(log1p(Float64(-z)) - b)))))
end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
↓
x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}
Alternatives Alternative 1 Error 0.5 Cost 14016
\[x \cdot e^{-1 + \left(y \cdot \left(\log z - t\right) + \left(1 - \left(z \cdot a + a \cdot b\right)\right)\right)}
\]
Alternative 2 Error 6.9 Cost 7112
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{+75}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{x}{e^{a \cdot \left(z + b\right)}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\]
Alternative 3 Error 26.3 Cost 7052
\[\begin{array}{l}
t_1 := x + a \cdot \left(x \cdot b\right)\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{-8}:\\
\;\;\;\;\frac{\left(a \cdot a\right) \cdot \left(\left(b \cdot b\right) \cdot \left(x \cdot \left(-x\right)\right)\right)}{t_1}\\
\mathbf{elif}\;y \leq 9.6 \cdot 10^{-275}:\\
\;\;\;\;x + \left(y \cdot t\right) \cdot \left(\left(y \cdot t\right) \cdot \left(x \cdot 0.5\right) - x\right)\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-112}:\\
\;\;\;\;\frac{x \cdot x}{t_1}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\]
Alternative 4 Error 8.7 Cost 6984
\[\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{-40}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{x}{e^{a \cdot b}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\]
Alternative 5 Error 19.7 Cost 6852
\[\begin{array}{l}
\mathbf{if}\;a \leq 3.4 \cdot 10^{+20}:\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {\left(-z\right)}^{a}\\
\end{array}
\]
Alternative 6 Error 11.0 Cost 6852
\[\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{x}{e^{a \cdot b}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\]
Alternative 7 Error 38.1 Cost 1809
\[\begin{array}{l}
t_1 := x + a \cdot \left(x \cdot b\right)\\
t_2 := \frac{\left(a \cdot a\right) \cdot \left(\left(b \cdot b\right) \cdot \left(x \cdot \left(-x\right)\right)\right)}{t_1}\\
\mathbf{if}\;y \leq -3 \cdot 10^{-7}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-275}:\\
\;\;\;\;x + \left(y \cdot t\right) \cdot \left(\left(y \cdot t\right) \cdot \left(x \cdot 0.5\right) - x\right)\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+119} \lor \neg \left(y \leq 5 \cdot 10^{+254}\right):\\
\;\;\;\;\frac{x \cdot x}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 8 Error 36.9 Cost 1233
\[\begin{array}{l}
t_1 := \frac{x \cdot x}{x + a \cdot \left(x \cdot b\right)}\\
\mathbf{if}\;y \leq -2 \cdot 10^{-8}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-273}:\\
\;\;\;\;x - x \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+119} \lor \neg \left(y \leq 2.3 \cdot 10^{+183}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot b\right) \cdot \left(-x\right)\\
\end{array}
\]
Alternative 9 Error 37.0 Cost 1233
\[\begin{array}{l}
t_1 := \frac{x \cdot x}{x + a \cdot \left(x \cdot b\right)}\\
\mathbf{if}\;y \leq -2 \cdot 10^{-8}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-272}:\\
\;\;\;\;x + x \cdot \left(\left(a \cdot b\right) \cdot \left(-1 + \left(a \cdot b\right) \cdot 0.5\right)\right)\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+119} \lor \neg \left(y \leq 1.4 \cdot 10^{+184}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot b\right) \cdot \left(-x\right)\\
\end{array}
\]
Alternative 10 Error 36.9 Cost 1233
\[\begin{array}{l}
t_1 := \frac{x \cdot x}{x + a \cdot \left(x \cdot b\right)}\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{-8}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-275}:\\
\;\;\;\;x + \left(y \cdot t\right) \cdot \left(\left(y \cdot t\right) \cdot \left(x \cdot 0.5\right) - x\right)\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+120} \lor \neg \left(y \leq 1.15 \cdot 10^{+185}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot b\right) \cdot \left(-x\right)\\
\end{array}
\]
Alternative 11 Error 40.3 Cost 649
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \lor \neg \left(y \leq 2.85 \cdot 10^{-30}\right):\\
\;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 12 Error 39.9 Cost 648
\[\begin{array}{l}
\mathbf{if}\;y \leq -4.2:\\
\;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\
\mathbf{elif}\;y \leq 4.6:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot b\right) \cdot \left(-x\right)\\
\end{array}
\]
Alternative 13 Error 40.0 Cost 585
\[\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \lor \neg \left(y \leq 4.6\right):\\
\;\;\;\;a \cdot \left(x \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 14 Error 44.7 Cost 64
\[x
\]