?

Average Accuracy: 96.7% → 99.6%
Time: 20.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 96.7%

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

    [Start]96.7

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

    fma-def [=>]97.0

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

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

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

    \[\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
Accuracy95.5%
Cost27460
\[\begin{array}{l} t_1 := y \cdot \left(\log z - t\right)\\ \mathbf{if}\;t_1 + a \cdot \left(\log \left(1 - z\right) - b\right) \leq -2 \cdot 10^{+39}:\\ \;\;\;\;x \cdot e^{-1 + \left(t_1 + \left(1 - a \cdot b\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\ \end{array} \]
Alternative 2
Accuracy89.8%
Cost7176
\[\begin{array}{l} \mathbf{if}\;y \leq -2.35 \cdot 10^{+89}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 1.6:\\ \;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 3
Accuracy86.8%
Cost7048
\[\begin{array}{l} \mathbf{if}\;y \leq -2.15 \cdot 10^{+89}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 1.15:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 4
Accuracy56.2%
Cost6921
\[\begin{array}{l} \mathbf{if}\;b \leq 1.45 \cdot 10^{+191} \lor \neg \left(b \leq 4.8 \cdot 10^{+278}\right):\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 5
Accuracy83.4%
Cost6916
\[\begin{array}{l} \mathbf{if}\;y \leq 0.185:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 6
Accuracy29.3%
Cost976
\[\begin{array}{l} \mathbf{if}\;b \leq -3.4 \cdot 10^{+116}:\\ \;\;\;\;t \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{elif}\;b \leq -4.4 \cdot 10^{-303}:\\ \;\;\;\;x\\ \mathbf{elif}\;b \leq 1.75 \cdot 10^{-122}:\\ \;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\ \mathbf{elif}\;b \leq 2.5 \cdot 10^{+112}:\\ \;\;\;\;x \cdot \left(1 - a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 7
Accuracy29.2%
Cost976
\[\begin{array}{l} \mathbf{if}\;b \leq -1.36 \cdot 10^{+116}:\\ \;\;\;\;t \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{elif}\;b \leq -2.7 \cdot 10^{-302}:\\ \;\;\;\;x\\ \mathbf{elif}\;b \leq 1.25 \cdot 10^{-123}:\\ \;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\ \mathbf{elif}\;b \leq 1.6 \cdot 10^{+112}:\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 8
Accuracy29.3%
Cost976
\[\begin{array}{l} t_1 := x \cdot \left(y \cdot t\right)\\ \mathbf{if}\;b \leq -3.9 \cdot 10^{+117}:\\ \;\;\;\;t \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{elif}\;b \leq -4.8 \cdot 10^{-302}:\\ \;\;\;\;x\\ \mathbf{elif}\;b \leq 1.26 \cdot 10^{-123}:\\ \;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\ \mathbf{elif}\;b \leq 1.25 \cdot 10^{+110}:\\ \;\;\;\;x - t_1\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Accuracy29.4%
Cost848
\[\begin{array}{l} t_1 := x \cdot \left(y \cdot t\right)\\ \mathbf{if}\;b \leq -3.9 \cdot 10^{+117}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq -2.7 \cdot 10^{-301}:\\ \;\;\;\;x\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{-122}:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \mathbf{elif}\;b \leq 2.2 \cdot 10^{+198}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Accuracy29.5%
Cost848
\[\begin{array}{l} \mathbf{if}\;b \leq -4.7 \cdot 10^{+115}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{elif}\;b \leq -2.75 \cdot 10^{-300}:\\ \;\;\;\;x\\ \mathbf{elif}\;b \leq 2.15 \cdot 10^{-123}:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{+198}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 11
Accuracy29.5%
Cost848
\[\begin{array}{l} \mathbf{if}\;b \leq -1.35 \cdot 10^{+116}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{elif}\;b \leq -4.6 \cdot 10^{-301}:\\ \;\;\;\;x\\ \mathbf{elif}\;b \leq 1.35 \cdot 10^{-123}:\\ \;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\ \mathbf{elif}\;b \leq 2.5 \cdot 10^{+198}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 12
Accuracy29.5%
Cost848
\[\begin{array}{l} \mathbf{if}\;b \leq -3.8 \cdot 10^{+117}:\\ \;\;\;\;t \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{elif}\;b \leq -1.7 \cdot 10^{-299}:\\ \;\;\;\;x\\ \mathbf{elif}\;b \leq 3.2 \cdot 10^{-123}:\\ \;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\ \mathbf{elif}\;b \leq 2.8 \cdot 10^{+198}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 13
Accuracy35.3%
Cost452
\[\begin{array}{l} \mathbf{if}\;y \leq 3.8 \cdot 10^{-5}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \end{array} \]
Alternative 14
Accuracy30.1%
Cost64
\[x \]

Error

Reproduce?

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