Average Error: 1.8 → 0.2
Time: 11.4s
Precision: binary64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
\[\begin{array}{l} t_1 := \log z - t\\ \left(x \cdot \sqrt{e^{\mathsf{fma}\left(y, t_1, a \cdot \left(-\left(z + b\right)\right)\right)}}\right) \cdot \sqrt{e^{\mathsf{fma}\left(y, t_1, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}} \end{array} \]
(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
 (let* ((t_1 (- (log z) t)))
   (*
    (* x (sqrt (exp (fma y t_1 (* a (- (+ z b)))))))
    (sqrt (exp (fma y t_1 (* 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) {
	double t_1 = log(z) - t;
	return (x * sqrt(exp(fma(y, t_1, (a * -(z + b)))))) * sqrt(exp(fma(y, t_1, (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)
	t_1 = Float64(log(z) - t)
	return Float64(Float64(x * sqrt(exp(fma(y, t_1, Float64(a * Float64(-Float64(z + b))))))) * sqrt(exp(fma(y, t_1, 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_] := Block[{t$95$1 = N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]}, N[(N[(x * N[Sqrt[N[Exp[N[(y * t$95$1 + N[(a * (-N[(z + b), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Exp[N[(y * t$95$1 + N[(a * N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision]), $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)}
\begin{array}{l}
t_1 := \log z - t\\
\left(x \cdot \sqrt{e^{\mathsf{fma}\left(y, t_1, a \cdot \left(-\left(z + b\right)\right)\right)}}\right) \cdot \sqrt{e^{\mathsf{fma}\left(y, t_1, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}}
\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Derivation

  1. Initial program 1.8

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

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

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

    \[\leadsto \color{blue}{\left(x \cdot \sqrt{e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}}\right) \cdot \sqrt{e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}}} \]
  5. Taylor expanded in z around 0 0.2

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

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

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

Reproduce

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