Average Error: 9.2 → 0.3
Time: 11.7s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\left(\mathsf{fma}\left(x, \log y, \mathsf{fma}\left(z, \log 1 - 1 \cdot y, \frac{z \cdot {y}^{2}}{{1}^{2}} \cdot \frac{-1}{2}\right)\right) - t\right) + \left(t - t\right)\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\left(\mathsf{fma}\left(x, \log y, \mathsf{fma}\left(z, \log 1 - 1 \cdot y, \frac{z \cdot {y}^{2}}{{1}^{2}} \cdot \frac{-1}{2}\right)\right) - t\right) + \left(t - t\right)
double f(double x, double y, double z, double t) {
        double r440550 = x;
        double r440551 = y;
        double r440552 = log(r440551);
        double r440553 = r440550 * r440552;
        double r440554 = z;
        double r440555 = 1.0;
        double r440556 = r440555 - r440551;
        double r440557 = log(r440556);
        double r440558 = r440554 * r440557;
        double r440559 = r440553 + r440558;
        double r440560 = t;
        double r440561 = r440559 - r440560;
        return r440561;
}

double f(double x, double y, double z, double t) {
        double r440562 = x;
        double r440563 = y;
        double r440564 = log(r440563);
        double r440565 = z;
        double r440566 = 1.0;
        double r440567 = log(r440566);
        double r440568 = r440566 * r440563;
        double r440569 = r440567 - r440568;
        double r440570 = 2.0;
        double r440571 = pow(r440563, r440570);
        double r440572 = r440565 * r440571;
        double r440573 = pow(r440566, r440570);
        double r440574 = r440572 / r440573;
        double r440575 = -0.5;
        double r440576 = r440574 * r440575;
        double r440577 = fma(r440565, r440569, r440576);
        double r440578 = fma(r440562, r440564, r440577);
        double r440579 = t;
        double r440580 = r440578 - r440579;
        double r440581 = r440579 - r440579;
        double r440582 = r440580 + r440581;
        return r440582;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.2
Target0.3
Herbie0.3
\[\left(-z\right) \cdot \left(\left(0.5 \cdot \left(y \cdot y\right) + y\right) + \frac{0.333333333333333315}{1 \cdot \left(1 \cdot 1\right)} \cdot \left(y \cdot \left(y \cdot y\right)\right)\right) - \left(t - x \cdot \log y\right)\]

Derivation

  1. Initial program 9.2

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \log y, z \cdot \log \left(1 - y\right)\right) - t}\]
  3. Taylor expanded around 0 0.3

    \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{z \cdot \log 1 - \left(1 \cdot \left(z \cdot y\right) + \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)}\right) - t\]
  4. Simplified0.3

    \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{z \cdot \left(\log 1 - 1 \cdot y\right) - \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}}\right) - t\]
  5. Using strategy rm
  6. Applied add-cube-cbrt0.9

    \[\leadsto \mathsf{fma}\left(x, \log y, z \cdot \left(\log 1 - 1 \cdot y\right) - \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right) - \color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}\]
  7. Applied add-sqr-sqrt32.8

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

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

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

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

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

Reproduce

herbie shell --seed 2020045 +o rules:numerics
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"
  :precision binary64

  :herbie-target
  (- (* (- z) (+ (+ (* 0.5 (* y y)) y) (* (/ 0.3333333333333333 (* 1 (* 1 1))) (* y (* y y))))) (- t (* x (log y))))

  (- (+ (* x (log y)) (* z (log (- 1 y)))) t))