?

Average Accuracy: 96.8% → 99.7%
Time: 26.3s
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.8%

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

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

    fma-def [=>]97.2

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

    \[ 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.5%
Cost13636
\[\begin{array}{l} \mathbf{if}\;a \leq 1.5 \cdot 10^{+114}:\\ \;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right) - a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 0\\ \end{array} \]
Alternative 2
Accuracy94.1%
Cost13576
\[\begin{array}{l} \mathbf{if}\;y \leq -1.35 \cdot 10^{-165}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right) - a \cdot b}\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{-38}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\ \end{array} \]
Alternative 3
Accuracy95.5%
Cost13380
\[\begin{array}{l} \mathbf{if}\;y \leq 1.45 \cdot 10^{-39}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right) - a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\ \end{array} \]
Alternative 4
Accuracy39.9%
Cost7189
\[\begin{array}{l} \mathbf{if}\;y \leq -6.4 \cdot 10^{-83}:\\ \;\;\;\;{x}^{-3}\\ \mathbf{elif}\;y \leq 0.0003:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+94} \lor \neg \left(y \leq 5.4 \cdot 10^{+132}\right) \land y \leq 5.2 \cdot 10^{+153}:\\ \;\;\;\;{x}^{-3}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \end{array} \]
Alternative 5
Accuracy96.7%
Cost7172
\[\begin{array}{l} \mathbf{if}\;y \leq 0.006:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right) - a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 0\\ \end{array} \]
Alternative 6
Accuracy91.2%
Cost6984
\[\begin{array}{l} \mathbf{if}\;y \leq -0.0043:\\ \;\;\;\;x \cdot 0\\ \mathbf{elif}\;y \leq 2.02 \cdot 10^{-20}:\\ \;\;\;\;\frac{x}{e^{a \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 0\\ \end{array} \]
Alternative 7
Accuracy79.0%
Cost6920
\[\begin{array}{l} \mathbf{if}\;a \leq -4.4 \cdot 10^{-29}:\\ \;\;\;\;x \cdot 0\\ \mathbf{elif}\;a \leq 3.35 \cdot 10^{-41}:\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 0\\ \end{array} \]
Alternative 8
Accuracy74.3%
Cost2017
\[\begin{array}{l} t_1 := x + x \cdot \left(b \cdot \left(0.5 \cdot \left(a \cdot \left(a \cdot b\right)\right) - a\right)\right)\\ \mathbf{if}\;y \leq -3.3 \cdot 10^{-115}:\\ \;\;\;\;x \cdot 0\\ \mathbf{elif}\;y \leq -7 \cdot 10^{-167}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -4.2 \cdot 10^{-267}:\\ \;\;\;\;x \cdot 0\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{-147}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-57}:\\ \;\;\;\;x \cdot 0\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-29} \lor \neg \left(y \leq 4.05 \cdot 10^{-25}\right):\\ \;\;\;\;x \cdot 0\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 + t \cdot \left(t \cdot \left(0.5 \cdot \left(y \cdot y\right)\right) - y\right)\right)\\ \end{array} \]
Alternative 9
Accuracy37.8%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -5.8 \cdot 10^{+46} \lor \neg \left(y \leq 1.38 \cdot 10^{-15}\right):\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Accuracy37.6%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+81}:\\ \;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\ \mathbf{elif}\;y \leq 1.38 \cdot 10^{-15}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \end{array} \]
Alternative 11
Accuracy30.2%
Cost64
\[x \]

Error

Reproduce?

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