Average Error: 7.1 → 0.1
Time: 4.9s
Precision: binary64
\[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
\[\begin{array}{l} t_1 := \log \left(\frac{1}{y}\right)\\ -\mathsf{fma}\left(\mathsf{log1p}\left(-y\right), 1 - z, \left(t + t_1 \cdot x\right) - t_1\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (log (/ 1.0 y))))
   (- (fma (log1p (- y)) (- 1.0 z) (- (+ t (* t_1 x)) t_1)))))
double code(double x, double y, double z, double t) {
	return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
double code(double x, double y, double z, double t) {
	double t_1 = log((1.0 / y));
	return -fma(log1p(-y), (1.0 - z), ((t + (t_1 * x)) - t_1));
}
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t)
end
function code(x, y, z, t)
	t_1 = log(Float64(1.0 / y))
	return Float64(-fma(log1p(Float64(-y)), Float64(1.0 - z), Float64(Float64(t + Float64(t_1 * x)) - t_1)))
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Log[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]}, (-N[(N[Log[1 + (-y)], $MachinePrecision] * N[(1.0 - z), $MachinePrecision] + N[(N[(t + N[(t$95$1 * x), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision])]
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\begin{array}{l}
t_1 := \log \left(\frac{1}{y}\right)\\
-\mathsf{fma}\left(\mathsf{log1p}\left(-y\right), 1 - z, \left(t + t_1 \cdot x\right) - t_1\right)
\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 7.1

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Simplified0.1

    \[\leadsto \color{blue}{-\mathsf{fma}\left(\mathsf{log1p}\left(-y\right), 1 - z, \mathsf{fma}\left(\log y, 1 - x, t\right)\right)} \]
  3. Taylor expanded in y around inf 0.1

    \[\leadsto -\mathsf{fma}\left(\mathsf{log1p}\left(-y\right), 1 - z, \color{blue}{\left(t + \log \left(\frac{1}{y}\right) \cdot x\right) - \log \left(\frac{1}{y}\right)}\right) \]
  4. Final simplification0.1

    \[\leadsto -\mathsf{fma}\left(\mathsf{log1p}\left(-y\right), 1 - z, \left(t + \log \left(\frac{1}{y}\right) \cdot x\right) - \log \left(\frac{1}{y}\right)\right) \]

Reproduce

herbie shell --seed 2022166 
(FPCore (x y z t)
  :name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"
  :precision binary64
  (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))