Average Error: 6.9 → 0.1
Time: 23.7s
Precision: binary64
\[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
\[\left(\log y \cdot x + \mathsf{fma}\left(\mathsf{log1p}\left(-y\right), z + -1, -\log y\right)\right) - t \]
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\left(\log y \cdot x + \mathsf{fma}\left(\mathsf{log1p}\left(-y\right), z + -1, -\log y\right)\right) - t
(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
 (- (+ (* (log y) x) (fma (log1p (- y)) (+ z -1.0) (- (log y)))) t))
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) {
	return ((log(y) * x) + fma(log1p(-y), (z + -1.0), -log(y))) - t;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 6.9

    \[\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(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right) - t} \]
  3. Applied add-cube-cbrt_binary640.8

    \[\leadsto \color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}} - t \]
  4. Applied pow1_binary640.8

    \[\leadsto \left(\sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}\right) \cdot \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}\right)}^{1}} - t \]
  5. Applied pow1_binary640.8

    \[\leadsto \left(\sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)} \cdot \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}\right)}^{1}}\right) \cdot {\left(\sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}\right)}^{1} - t \]
  6. Applied pow1_binary640.8

    \[\leadsto \left(\color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}\right)}^{1}} \cdot {\left(\sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}\right)}^{1}\right) \cdot {\left(\sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}\right)}^{1} - t \]
  7. Applied pow-prod-down_binary640.8

    \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}\right)}^{1}} \cdot {\left(\sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}\right)}^{1} - t \]
  8. Applied pow-prod-down_binary640.8

    \[\leadsto \color{blue}{{\left(\left(\sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \mathsf{log1p}\left(-y\right)\right)}\right)}^{1}} - t \]
  9. Simplified0.1

    \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(x + -1, \log y, \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right)\right)\right)}}^{1} - t \]
  10. Taylor expanded in x around 0 6.9

    \[\leadsto {\color{blue}{\left(\left(\log \left(1 - y\right) \cdot z + \log y \cdot x\right) - \left(\log \left(1 - y\right) + \log y\right)\right)}}^{1} - t \]
  11. Simplified0.1

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

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

Reproduce

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