?

Average Accuracy: 96.8% → 99.6%
Time: 24.5s
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 96.8%

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

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

    +-commutative [=>]96.8

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

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

    \[ 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
Accuracy97.8%
Cost20292
\[\begin{array}{l} \mathbf{if}\;a \leq 7.6 \cdot 10^{+159}:\\ \;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{\left(-a\right) \cdot \left(z + b\right)}\\ \end{array} \]
Alternative 2
Accuracy61.1%
Cost7448
\[\begin{array}{l} t_1 := x \cdot e^{a \cdot b}\\ \mathbf{if}\;y \leq -1.7 \cdot 10^{-28}:\\ \;\;\;\;\left(1 + a \cdot \left(x \cdot b\right)\right) + -1\\ \mathbf{elif}\;y \leq 7.9 \cdot 10^{-277}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-231}:\\ \;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-95}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-93}:\\ \;\;\;\;\left(a \cdot b\right) \cdot \left(-x\right)\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-35}:\\ \;\;\;\;\left(1 + x \cdot \left(1 - y \cdot t\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 3
Accuracy89.5%
Cost7176
\[\begin{array}{l} \mathbf{if}\;y \leq -1.55 \cdot 10^{-24}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 0.46:\\ \;\;\;\;x \cdot e^{\left(-a\right) \cdot \left(z + b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 4
Accuracy61.6%
Cost7052
\[\begin{array}{l} t_1 := x \cdot \left(1 - y \cdot t\right)\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{-29}:\\ \;\;\;\;\left(1 + a \cdot \left(x \cdot b\right)\right) + -1\\ \mathbf{elif}\;y \leq 1.22 \cdot 10^{-298}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{-34}:\\ \;\;\;\;\left(1 + t_1\right) + -1\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 5
Accuracy86.9%
Cost7048
\[\begin{array}{l} \mathbf{if}\;y \leq -1.55 \cdot 10^{-24}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 0.46:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 6
Accuracy82.8%
Cost6916
\[\begin{array}{l} \mathbf{if}\;y \leq 0.45:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 7
Accuracy45.9%
Cost1368
\[\begin{array}{l} t_1 := \left(1 + a \cdot \left(x \cdot b\right)\right) + -1\\ \mathbf{if}\;y \leq -2.4 \cdot 10^{-28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-276}:\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-231}:\\ \;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-152}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.95 \cdot 10^{-32}:\\ \;\;\;\;\left(1 + x \cdot \left(1 - a \cdot b\right)\right) + -1\\ \mathbf{elif}\;y \leq 1.42 \cdot 10^{+16}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Accuracy46.4%
Cost1104
\[\begin{array}{l} t_1 := \left(1 + a \cdot \left(x \cdot b\right)\right) + -1\\ \mathbf{if}\;y \leq -6.6 \cdot 10^{-31}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-277}:\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \mathbf{elif}\;y \leq 4.9 \cdot 10^{-231}:\\ \;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{elif}\;y \leq 1.42 \cdot 10^{+16}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Accuracy48.0%
Cost1100
\[\begin{array}{l} t_1 := x \cdot \left(1 - y \cdot t\right)\\ t_2 := \left(1 + a \cdot \left(x \cdot b\right)\right) + -1\\ \mathbf{if}\;y \leq -2.1 \cdot 10^{-29}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{-299}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+18}:\\ \;\;\;\;\left(1 + t_1\right) + -1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 10
Accuracy35.4%
Cost912
\[\begin{array}{l} \mathbf{if}\;y \leq -1.55 \cdot 10^{-24}:\\ \;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{-279}:\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \mathbf{elif}\;y \leq 4.9 \cdot 10^{-231}:\\ \;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+44}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot b\right) \cdot \left(-x\right)\\ \end{array} \]
Alternative 11
Accuracy33.6%
Cost780
\[\begin{array}{l} \mathbf{if}\;y \leq 9 \cdot 10^{-277}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{-231}:\\ \;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{+44}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot b\right) \cdot \left(-x\right)\\ \end{array} \]
Alternative 12
Accuracy33.1%
Cost716
\[\begin{array}{l} \mathbf{if}\;y \leq 7.9 \cdot 10^{-277}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-231}:\\ \;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+44}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \end{array} \]
Alternative 13
Accuracy34.7%
Cost452
\[\begin{array}{l} \mathbf{if}\;y \leq 2.6 \cdot 10^{+44}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \end{array} \]
Alternative 14
Accuracy29.9%
Cost64
\[x \]

Error

Reproduce?

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