?

Average Accuracy: 96.6% → 99.6%
Time: 26.4s
Precision: binary64
Cost: 26368

?

\[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)}

Error?

Derivation?

  1. Initial program 96.6%

    \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
  2. Simplified99.6%

    \[\leadsto \color{blue}{x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}} \]
    Proof

    [Start]96.6

    \[ x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]

    fma-def [=>]97.0

    \[ x \cdot e^{\color{blue}{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\log \left(1 - z\right) - b\right)\right)}} \]

    sub-neg [=>]97.0

    \[ x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\log \color{blue}{\left(1 + \left(-z\right)\right)} - b\right)\right)} \]

    log1p-def [=>]99.6

    \[ x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\color{blue}{\mathsf{log1p}\left(-z\right)} - b\right)\right)} \]
  3. Final simplification99.6%

    \[\leadsto x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)} \]

Alternatives

Alternative 1
Accuracy98.4%
Cost27204
\[\begin{array}{l} \mathbf{if}\;a \cdot \left(\log \left(1 - z\right) - b\right) - y \cdot \left(t - \log z\right) \leq -1.2 \cdot 10^{-14}:\\ \;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right) - a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}\\ \end{array} \]
Alternative 2
Accuracy89.9%
Cost13576
\[\begin{array}{l} \mathbf{if}\;y \leq -2.9 \cdot 10^{+68}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-5}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 3
Accuracy62.8%
Cost7184
\[\begin{array}{l} t_1 := x + a \cdot \left(x \cdot b\right)\\ t_2 := \frac{x \cdot x}{t_1}\\ \mathbf{if}\;y \leq -1.4 \cdot 10^{+119}:\\ \;\;\;\;\frac{\left(\left(b \cdot b\right) \cdot \left(x \cdot x\right)\right) \cdot \left(a \cdot \left(-a\right)\right)}{t_1}\\ \mathbf{elif}\;y \leq -3.9 \cdot 10^{-46}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -2.65 \cdot 10^{-138}:\\ \;\;\;\;x \cdot e^{a \cdot b}\\ \mathbf{elif}\;y \leq -7.6 \cdot 10^{-221}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 4
Accuracy82.4%
Cost7048
\[\begin{array}{l} \mathbf{if}\;y \leq -1.2 \cdot 10^{+160}:\\ \;\;\;\;\frac{\left(\left(b \cdot b\right) \cdot \left(x \cdot x\right)\right) \cdot \left(a \cdot \left(-a\right)\right)}{x + a \cdot \left(x \cdot b\right)}\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{-5}:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 5
Accuracy87.0%
Cost7048
\[\begin{array}{l} \mathbf{if}\;y \leq -9.6 \cdot 10^{+67}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-5}:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 6
Accuracy62.4%
Cost6920
\[\begin{array}{l} t_1 := x + a \cdot \left(x \cdot b\right)\\ \mathbf{if}\;y \leq -7 \cdot 10^{+121}:\\ \;\;\;\;\frac{\left(\left(b \cdot b\right) \cdot \left(x \cdot x\right)\right) \cdot \left(a \cdot \left(-a\right)\right)}{t_1}\\ \mathbf{elif}\;y \leq -9.5 \cdot 10^{-221}:\\ \;\;\;\;\frac{x \cdot x}{t_1}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 7
Accuracy41.3%
Cost2072
\[\begin{array}{l} t_1 := x + a \cdot \left(x \cdot b\right)\\ t_2 := \frac{\left(\left(b \cdot b\right) \cdot \left(x \cdot x\right)\right) \cdot \left(a \cdot \left(-a\right)\right)}{t_1}\\ t_3 := \frac{x \cdot x}{t_1}\\ \mathbf{if}\;y \leq -7 \cdot 10^{+121}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{-221}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 10^{-221}:\\ \;\;\;\;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 4.5 \cdot 10^{+46}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{+95}:\\ \;\;\;\;0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(t \cdot \left(x \cdot t\right)\right)\right)\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+202}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+242}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\ \end{array} \]
Alternative 8
Accuracy34.5%
Cost1232
\[\begin{array}{l} t_1 := 0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(t \cdot \left(x \cdot t\right)\right)\right)\\ \mathbf{if}\;a \leq -1.85 \cdot 10^{-10}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 2.9 \cdot 10^{-242}:\\ \;\;\;\;\frac{1 - a \cdot b}{\frac{1}{x}}\\ \mathbf{elif}\;a \leq 4.9 \cdot 10^{-119}:\\ \;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\ \mathbf{elif}\;a \leq 3 \cdot 10^{+24}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Accuracy43.0%
Cost1232
\[\begin{array}{l} t_1 := \frac{x \cdot x}{x + a \cdot \left(x \cdot b\right)}\\ \mathbf{if}\;a \leq -1.8 \cdot 10^{-58}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 4.5 \cdot 10^{-242}:\\ \;\;\;\;\frac{1 - a \cdot b}{\frac{1}{x}}\\ \mathbf{elif}\;a \leq 1.3 \cdot 10^{-117}:\\ \;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\ \mathbf{elif}\;a \leq 1.15 \cdot 10^{-77}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Accuracy43.0%
Cost1232
\[\begin{array}{l} t_1 := \frac{x \cdot x}{x + a \cdot \left(x \cdot b\right)}\\ \mathbf{if}\;a \leq -2 \cdot 10^{-58}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 3.1 \cdot 10^{-242}:\\ \;\;\;\;x + x \cdot \left(\left(a \cdot b\right) \cdot \left(-1 + \left(a \cdot b\right) \cdot 0.5\right)\right)\\ \mathbf{elif}\;a \leq 4.2 \cdot 10^{-119}:\\ \;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\ \mathbf{elif}\;a \leq 3.45 \cdot 10^{-77}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Accuracy37.2%
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -80000:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+16}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\ \end{array} \]
Alternative 12
Accuracy37.2%
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -3.9:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+16}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\ \end{array} \]
Alternative 13
Accuracy37.3%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -4 \lor \neg \left(y \leq 1.35 \cdot 10^{+25}\right):\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 14
Accuracy30.1%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023133 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B"
  :precision binary64
  (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))