Average Error: 2.0 → 0.2
Time: 26.3s
Precision: binary64
Cost: 32768
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
\[x \cdot {e}^{\left(\mathsf{fma}\left(\mathsf{log1p}\left(-z\right) - b, a, \left(\log z - t\right) \cdot y\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 (pow E (fma (- (log1p (- z)) b) a (* (- (log z) t) y)))))
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 * pow(((double) M_E), fma((log1p(-z) - b), a, ((log(z) - t) * y)));
}
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(1) ^ fma(Float64(log1p(Float64(-z)) - b), a, Float64(Float64(log(z) - t) * y))))
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[Power[E, N[(N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision] * a + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $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}^{\left(\mathsf{fma}\left(\mathsf{log1p}\left(-z\right) - b, a, \left(\log z - t\right) \cdot y\right)\right)}

Error

Derivation

  1. Initial program 2.0

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

    \[\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
  3. Applied egg-rr0.3

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

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

Alternatives

Alternative 1
Error1.0
Cost27204
\[\begin{array}{l} t_1 := \log z - t\\ \mathbf{if}\;y \cdot t_1 + a \cdot \left(\log \left(1 - z\right) - b\right) \leq -2 \cdot 10^{-14}:\\ \;\;\;\;x \cdot e^{t_1 \cdot y - a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{\left(-a \cdot z\right) + \left(-a \cdot b\right)}\\ \end{array} \]
Alternative 2
Error0.3
Cost26368
\[x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)} \]
Alternative 3
Error6.4
Cost13384
\[\begin{array}{l} \mathbf{if}\;y \leq -2.4 \cdot 10^{+92}:\\ \;\;\;\;\frac{x}{e^{y \cdot t}}\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{-13}:\\ \;\;\;\;x \cdot e^{\left(-a \cdot z\right) + \left(-a \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{y \cdot \log z}\\ \end{array} \]
Alternative 4
Error14.3
Cost8148
\[\begin{array}{l} t_1 := x \cdot e^{\left(-a \cdot z\right) + \left(-a \cdot b\right)}\\ t_2 := e^{y \cdot t}\\ t_3 := \frac{x}{t_2}\\ \mathbf{if}\;y \leq -5.4 \cdot 10^{+91}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{-13}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{+44}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;x \ne 0:\\ \;\;\;\;\frac{1}{\frac{t_2}{x}}\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array}\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{+100}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \ne 0:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(0.5, \frac{\left(y \cdot y\right) \cdot \left(t \cdot t\right)}{x}, \frac{t + 1}{x}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 5
Error14.1
Cost7368
\[\begin{array}{l} \mathbf{if}\;t \leq -2.3 \cdot 10^{+72}:\\ \;\;\;\;\frac{x}{e^{y \cdot t}}\\ \mathbf{elif}\;t \leq 0.44:\\ \;\;\;\;x \cdot e^{\left(-a \cdot z\right) + \left(-a \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{-y \cdot t}\\ \end{array} \]
Alternative 6
Error16.2
Cost7048
\[\begin{array}{l} \mathbf{if}\;t \leq -3 \cdot 10^{+17}:\\ \;\;\;\;\frac{x}{e^{y \cdot t}}\\ \mathbf{elif}\;t \leq 3 \cdot 10^{-144}:\\ \;\;\;\;\frac{x}{e^{a \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{-y \cdot t}\\ \end{array} \]
Alternative 7
Error22.1
Cost6984
\[\begin{array}{l} t_1 := \frac{x}{e^{a \cdot b}}\\ \mathbf{if}\;b \leq -7.2 \cdot 10^{-25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 9 \cdot 10^{-181}:\\ \;\;\;\;\frac{x}{e^{a \cdot z}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error16.2
Cost6984
\[\begin{array}{l} t_1 := \frac{x}{e^{y \cdot t}}\\ \mathbf{if}\;t \leq -7.5 \cdot 10^{+17}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2.45 \cdot 10^{-144}:\\ \;\;\;\;\frac{x}{e^{a \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error22.7
Cost6720
\[\frac{x}{e^{a \cdot b}} \]
Alternative 10
Error42.7
Cost324
\[\begin{array}{l} \mathbf{if}\;y \leq 3.6 \cdot 10^{-55}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot x\\ \end{array} \]
Alternative 11
Error44.4
Cost64
\[x \]

Error

Reproduce

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