?

Average Accuracy: 96.6% → 99.6%
Time: 22.7s
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.6%

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

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

    fma-def [=>]97.1

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

    \[ 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
Accuracy98.8%
Cost33860
\[\begin{array}{l} t_1 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{-8}:\\ \;\;\;\;x \cdot e^{t_1}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\ \end{array} \]
Alternative 2
Accuracy75.5%
Cost13585
\[\begin{array}{l} t_1 := x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{if}\;y \leq -1.25 \cdot 10^{+42}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.45 \cdot 10^{-9}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+55} \lor \neg \left(y \leq 3.7 \cdot 10^{+118}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot {\left(e^{y}\right)}^{t}\\ \end{array} \]
Alternative 3
Accuracy89.7%
Cost13384
\[\begin{array}{l} \mathbf{if}\;y \leq -1.16 \cdot 10^{+42}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-10}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{y \cdot \log z}\\ \end{array} \]
Alternative 4
Accuracy34.5%
Cost7512
\[\begin{array}{l} t_1 := x \cdot e^{a \cdot b}\\ \mathbf{if}\;b \leq -9.8 \cdot 10^{+268}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;b \leq -2 \cdot 10^{+219}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq -5.2 \cdot 10^{+174}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{elif}\;b \leq -2.1 \cdot 10^{-276}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 5.7 \cdot 10^{-216}:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \mathbf{elif}\;b \leq 4.6 \cdot 10^{+74}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \end{array} \]
Alternative 5
Accuracy76.0%
Cost7177
\[\begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{+41} \lor \neg \left(y \leq 7.8 \cdot 10^{-8}\right):\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\ \end{array} \]
Alternative 6
Accuracy66.5%
Cost7049
\[\begin{array}{l} \mathbf{if}\;b \leq -4.8 \cdot 10^{-161} \lor \neg \left(b \leq 2 \cdot 10^{-236}\right):\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{z \cdot \left(-a\right)}\\ \end{array} \]
Alternative 7
Accuracy73.2%
Cost7049
\[\begin{array}{l} \mathbf{if}\;y \leq -1.15 \cdot 10^{+42} \lor \neg \left(y \leq 4.4 \cdot 10^{-8}\right):\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \end{array} \]
Alternative 8
Accuracy52.2%
Cost7048
\[\begin{array}{l} \mathbf{if}\;a \leq -2.5 \cdot 10^{+85}:\\ \;\;\;\;x \cdot e^{z \cdot a}\\ \mathbf{elif}\;a \leq 4.5 \cdot 10^{-20}:\\ \;\;\;\;x \cdot e^{a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{z \cdot \left(-a\right)}\\ \end{array} \]
Alternative 9
Accuracy42.8%
Cost6984
\[\begin{array}{l} \mathbf{if}\;a \leq -2.65 \cdot 10^{+85}:\\ \;\;\;\;x \cdot e^{z \cdot a}\\ \mathbf{elif}\;a \leq 5.1 \cdot 10^{+121}:\\ \;\;\;\;x \cdot e^{a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \end{array} \]
Alternative 10
Accuracy28.7%
Cost1488
\[\begin{array}{l} t_1 := x - a \cdot \left(x \cdot \left(z + b\right)\right)\\ \mathbf{if}\;x \leq -5 \cdot 10^{-83}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 10^{-223}:\\ \;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-134}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.1 \cdot 10^{-103}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot \left(\left(a \cdot b\right) \cdot \left(-1 + \left(a \cdot b\right) \cdot 0.5\right)\right)\\ \end{array} \]
Alternative 11
Accuracy28.3%
Cost1108
\[\begin{array}{l} t_1 := x - a \cdot \left(x \cdot \left(z + b\right)\right)\\ \mathbf{if}\;x \leq -2.85 \cdot 10^{-92}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-227}:\\ \;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\ \mathbf{elif}\;x \leq 1.22 \cdot 10^{-133}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-103}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{elif}\;x \leq 8 \cdot 10^{+14}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - a \cdot \left(x \cdot b\right)\\ \end{array} \]
Alternative 12
Accuracy31.3%
Cost848
\[\begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+173}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;b \leq -8 \cdot 10^{-274}:\\ \;\;\;\;x\\ \mathbf{elif}\;b \leq 5.7 \cdot 10^{-216}:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \mathbf{elif}\;b \leq 3.1 \cdot 10^{+196}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \end{array} \]
Alternative 13
Accuracy31.3%
Cost848
\[\begin{array}{l} \mathbf{if}\;b \leq -2.3 \cdot 10^{+174}:\\ \;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{elif}\;b \leq -2.15 \cdot 10^{-275}:\\ \;\;\;\;x\\ \mathbf{elif}\;b \leq 1.22 \cdot 10^{-214}:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \mathbf{elif}\;b \leq 3.1 \cdot 10^{+196}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \end{array} \]
Alternative 14
Accuracy32.6%
Cost712
\[\begin{array}{l} \mathbf{if}\;a \leq -6.9 \cdot 10^{+47}:\\ \;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{elif}\;a \leq 1.9 \cdot 10^{+66}:\\ \;\;\;\;x - a \cdot \left(x \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\ \end{array} \]
Alternative 15
Accuracy33.8%
Cost585
\[\begin{array}{l} \mathbf{if}\;a \leq -6.9 \cdot 10^{+47} \lor \neg \left(a \leq 1.65 \cdot 10^{+66}\right):\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 16
Accuracy35.8%
Cost452
\[\begin{array}{l} \mathbf{if}\;y \leq 3.4 \cdot 10^{+18}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \end{array} \]
Alternative 17
Accuracy30.3%
Cost64
\[x \]

Error

Reproduce?

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