?

Average Accuracy: 97.0% → 99.6%
Time: 27.0s
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(a, \mathsf{log1p}\left(-z\right) - b, y \cdot \left(\log z - t\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 a (- (log1p (- z)) b) (* y (- (log z) t))))))
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(a, (log1p(-z) - b), (y * (log(z) - t))));
}
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(a, Float64(log1p(Float64(-z)) - b), Float64(y * Float64(log(z) - t)))))
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[(a * N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision] + N[(y * N[(N[Log[z], $MachinePrecision] - t), $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(a, \mathsf{log1p}\left(-z\right) - b, y \cdot \left(\log z - t\right)\right)}

Error?

Derivation?

  1. Initial program 97.0%

    \[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(a, \mathsf{log1p}\left(-z\right) - b, y \cdot \left(\log z - t\right)\right)}} \]
    Proof

    [Start]97.0

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

    +-commutative [=>]97.0

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

    fma-def [=>]97.4

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

    sub-neg [=>]97.4

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

    log1p-def [=>]99.6

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

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

Alternatives

Alternative 1
Accuracy98.6%
Cost20292
\[\begin{array}{l} \mathbf{if}\;a \leq 6.5 \cdot 10^{+113}:\\ \;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {\left(-z\right)}^{a}\\ \end{array} \]
Alternative 2
Accuracy89.0%
Cost7440
\[\begin{array}{l} t_1 := x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\ t_2 := x \cdot e^{t \cdot \left(-y\right)}\\ \mathbf{if}\;y \leq -3.1 \cdot 10^{+94}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-115}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-55}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 0.0013:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 3
Accuracy86.4%
Cost7312
\[\begin{array}{l} t_1 := x \cdot e^{a \cdot \left(-b\right)}\\ t_2 := x \cdot e^{t \cdot \left(-y\right)}\\ \mathbf{if}\;y \leq -2.7 \cdot 10^{+94}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.46 \cdot 10^{-116}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{-53}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 0.16:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 4
Accuracy84.2%
Cost7048
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{+155}:\\ \;\;\;\;\left(x + 1\right) + -1\\ \mathbf{elif}\;y \leq 0.08:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 5
Accuracy70.7%
Cost6984
\[\begin{array}{l} \mathbf{if}\;a \leq -3.3 \cdot 10^{+27}:\\ \;\;\;\;\left(x + 1\right) + -1\\ \mathbf{elif}\;a \leq 3.5 \cdot 10^{+32}:\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {\left(-z\right)}^{a}\\ \end{array} \]
Alternative 6
Accuracy65.1%
Cost6788
\[\begin{array}{l} \mathbf{if}\;y \leq -3.6 \cdot 10^{-213}:\\ \;\;\;\;\left(x + 1\right) + -1\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 7
Accuracy51.0%
Cost840
\[\begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{-214}:\\ \;\;\;\;\left(x + 1\right) + -1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-8}:\\ \;\;\;\;x - t \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 + a \cdot \left(x \cdot b\right)\right) + -1\\ \end{array} \]
Alternative 8
Accuracy37.1%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -5500000000 \lor \neg \left(y \leq 1.7 \cdot 10^{+24}\right):\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Accuracy50.5%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{-212} \lor \neg \left(y \leq 3.1 \cdot 10^{-126}\right):\\ \;\;\;\;\left(x + 1\right) + -1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Accuracy29.9%
Cost64
\[x \]

Error

Reproduce?

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