?

Average Accuracy: 97.2% → 99.7%
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 97.2%

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

    \[\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]97.2

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

    fma-def [=>]97.5

    \[ 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.5

    \[ 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.7

    \[ 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.7%

    \[\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.9%
Cost33860
\[\begin{array}{l} t_1 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\ \mathbf{if}\;t_1 \leq -0.01:\\ \;\;\;\;x \cdot e^{t_1}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{\left(-a\right) \cdot \left(z + b\right)}\\ \end{array} \]
Alternative 2
Accuracy86.0%
Cost7312
\[\begin{array}{l} t_1 := x \cdot e^{-a \cdot b}\\ t_2 := x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{if}\;y \leq -1.05 \cdot 10^{-94}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 2.25 \cdot 10^{-101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{-29}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 0.62:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 3
Accuracy89.3%
Cost7176
\[\begin{array}{l} \mathbf{if}\;y \leq -1.15 \cdot 10^{-62}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 2.7:\\ \;\;\;\;x \cdot e^{\left(-a\right) \cdot \left(z + b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 4
Accuracy83.7%
Cost6916
\[\begin{array}{l} \mathbf{if}\;y \leq 0.022:\\ \;\;\;\;x \cdot e^{-a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 5
Accuracy60.7%
Cost6788
\[\begin{array}{l} \mathbf{if}\;y \leq -4.7 \cdot 10^{-21}:\\ \;\;\;\;x \cdot \left(z \cdot \left(-a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 6
Accuracy32.2%
Cost848
\[\begin{array}{l} \mathbf{if}\;a \leq -8.2 \cdot 10^{+122}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;a \leq -3.05 \cdot 10^{-149}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -1.06 \cdot 10^{-231}:\\ \;\;\;\;b \cdot \left(a \cdot \left(-x\right)\right)\\ \mathbf{elif}\;a \leq 5.4 \cdot 10^{+41}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 7
Accuracy44.5%
Cost649
\[\begin{array}{l} \mathbf{if}\;y \leq -1.12 \cdot 10^{-20} \lor \neg \left(y \leq 1.5 \cdot 10^{-17}\right):\\ \;\;\;\;x \cdot \left(z \cdot \left(-a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Accuracy44.2%
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{-21}:\\ \;\;\;\;x \cdot \left(z \cdot \left(-a\right)\right)\\ \mathbf{elif}\;y \leq 8.1 \cdot 10^{-13}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \]
Alternative 9
Accuracy33.8%
Cost585
\[\begin{array}{l} \mathbf{if}\;a \leq -7 \cdot 10^{+124} \lor \neg \left(a \leq 4 \cdot 10^{+41}\right):\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Accuracy33.8%
Cost584
\[\begin{array}{l} \mathbf{if}\;a \leq -6.8 \cdot 10^{+124}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;a \leq 5.2 \cdot 10^{+41}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 11
Accuracy30.4%
Cost64
\[x \]

Error

Reproduce?

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