?

Average Accuracy: 96.6% → 99.6%
Time: 22.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
Accuracy96.6%
Cost20160
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
Alternative 2
Accuracy89.4%
Cost7176
\[\begin{array}{l} \mathbf{if}\;y \leq -5.7 \cdot 10^{+135}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 0.082:\\ \;\;\;\;x \cdot e^{a \cdot \left(\left(-b\right) - z\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 3
Accuracy68.0%
Cost7048
\[\begin{array}{l} \mathbf{if}\;y \leq -9.2 \cdot 10^{+138}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \left(a \cdot \left(b \cdot \left(a \cdot b\right)\right)\right)\right)\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-19}:\\ \;\;\;\;x \cdot e^{a \cdot \left(-z\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 4
Accuracy82.4%
Cost7048
\[\begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{+141}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \left(a \cdot \left(b \cdot \left(a \cdot b\right)\right)\right)\right)\\ \mathbf{elif}\;y \leq 0.00135:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 5
Accuracy86.5%
Cost7048
\[\begin{array}{l} \mathbf{if}\;y \leq -1.28 \cdot 10^{+98}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-5}:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 6
Accuracy60.9%
Cost6788
\[\begin{array}{l} \mathbf{if}\;y \leq -1.25 \cdot 10^{+24}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \left(a \cdot \left(b \cdot \left(a \cdot b\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 7
Accuracy42.1%
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+73} \lor \neg \left(y \leq 3.5 \cdot 10^{-38}\right):\\ \;\;\;\;0.5 \cdot \left(x \cdot \left(a \cdot \left(b \cdot \left(a \cdot b\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \end{array} \]
Alternative 8
Accuracy37.4%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+73} \lor \neg \left(y \leq 0.155\right):\\ \;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \end{array} \]
Alternative 9
Accuracy36.0%
Cost649
\[\begin{array}{l} \mathbf{if}\;y \leq -9.2 \cdot 10^{+135} \lor \neg \left(y \leq 8.2 \cdot 10^{+64}\right):\\ \;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Accuracy36.0%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+73} \lor \neg \left(y \leq 8.2 \cdot 10^{+64}\right):\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 11
Accuracy29.9%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023138 
(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))))))