Average Error: 9.4 → 0.4
Time: 15.4s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\left(\mathsf{fma}\left(2 \cdot \log \left(\sqrt[3]{y}\right), x, \log \left(\sqrt[3]{y}\right) \cdot x\right) + \mathsf{fma}\left(\frac{-1}{2}, \frac{z \cdot {y}^{2}}{{1}^{2}}, z \cdot \left(\log 1 - 1 \cdot y\right)\right)\right) - t\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\left(\mathsf{fma}\left(2 \cdot \log \left(\sqrt[3]{y}\right), x, \log \left(\sqrt[3]{y}\right) \cdot x\right) + \mathsf{fma}\left(\frac{-1}{2}, \frac{z \cdot {y}^{2}}{{1}^{2}}, z \cdot \left(\log 1 - 1 \cdot y\right)\right)\right) - t
double f(double x, double y, double z, double t) {
        double r607510 = x;
        double r607511 = y;
        double r607512 = log(r607511);
        double r607513 = r607510 * r607512;
        double r607514 = z;
        double r607515 = 1.0;
        double r607516 = r607515 - r607511;
        double r607517 = log(r607516);
        double r607518 = r607514 * r607517;
        double r607519 = r607513 + r607518;
        double r607520 = t;
        double r607521 = r607519 - r607520;
        return r607521;
}

double f(double x, double y, double z, double t) {
        double r607522 = 2.0;
        double r607523 = y;
        double r607524 = cbrt(r607523);
        double r607525 = log(r607524);
        double r607526 = r607522 * r607525;
        double r607527 = x;
        double r607528 = r607525 * r607527;
        double r607529 = fma(r607526, r607527, r607528);
        double r607530 = -0.5;
        double r607531 = z;
        double r607532 = pow(r607523, r607522);
        double r607533 = r607531 * r607532;
        double r607534 = 1.0;
        double r607535 = pow(r607534, r607522);
        double r607536 = r607533 / r607535;
        double r607537 = log(r607534);
        double r607538 = r607534 * r607523;
        double r607539 = r607537 - r607538;
        double r607540 = r607531 * r607539;
        double r607541 = fma(r607530, r607536, r607540);
        double r607542 = r607529 + r607541;
        double r607543 = t;
        double r607544 = r607542 - r607543;
        return r607544;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.4
Target0.3
Herbie0.4
\[\left(-z\right) \cdot \left(\left(0.5 \cdot \left(y \cdot y\right) + y\right) + \frac{0.3333333333333333148296162562473909929395}{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.4

    \[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
  2. Taylor expanded around 0 0.4

    \[\leadsto \left(x \cdot \log y + \color{blue}{\left(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)}\right) - t\]
  3. Simplified0.4

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

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

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

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

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

    \[\leadsto \left(\left(\left(2 \cdot \log \left(\sqrt[3]{y}\right)\right) \cdot x + \color{blue}{\log \left(\sqrt[3]{y}\right) \cdot x}\right) + \mathsf{fma}\left(\frac{-1}{2}, \frac{z \cdot {y}^{2}}{{1}^{2}}, z \cdot \left(\log 1 - 1 \cdot y\right)\right)\right) - t\]
  10. Using strategy rm
  11. Applied fma-def0.4

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

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

Reproduce

herbie shell --seed 2019351 +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))