Average Error: 9.6 → 0.4
Time: 18.8s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\mathsf{fma}\left(z, \log 1 - \mathsf{fma}\left(\frac{y}{1} \cdot \frac{y}{1}, \frac{1}{2}, y \cdot 1\right), \mathsf{fma}\left(\log \left(\sqrt[3]{y}\right), x + x, \log \left(\sqrt[3]{y}\right) \cdot x\right) - t\right) + \mathsf{fma}\left(-1, t, t\right)\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(z, \log 1 - \mathsf{fma}\left(\frac{y}{1} \cdot \frac{y}{1}, \frac{1}{2}, y \cdot 1\right), \mathsf{fma}\left(\log \left(\sqrt[3]{y}\right), x + x, \log \left(\sqrt[3]{y}\right) \cdot x\right) - t\right) + \mathsf{fma}\left(-1, t, t\right)
double f(double x, double y, double z, double t) {
        double r17801926 = x;
        double r17801927 = y;
        double r17801928 = log(r17801927);
        double r17801929 = r17801926 * r17801928;
        double r17801930 = z;
        double r17801931 = 1.0;
        double r17801932 = r17801931 - r17801927;
        double r17801933 = log(r17801932);
        double r17801934 = r17801930 * r17801933;
        double r17801935 = r17801929 + r17801934;
        double r17801936 = t;
        double r17801937 = r17801935 - r17801936;
        return r17801937;
}

double f(double x, double y, double z, double t) {
        double r17801938 = z;
        double r17801939 = 1.0;
        double r17801940 = log(r17801939);
        double r17801941 = y;
        double r17801942 = r17801941 / r17801939;
        double r17801943 = r17801942 * r17801942;
        double r17801944 = 0.5;
        double r17801945 = r17801941 * r17801939;
        double r17801946 = fma(r17801943, r17801944, r17801945);
        double r17801947 = r17801940 - r17801946;
        double r17801948 = cbrt(r17801941);
        double r17801949 = log(r17801948);
        double r17801950 = x;
        double r17801951 = r17801950 + r17801950;
        double r17801952 = r17801949 * r17801950;
        double r17801953 = fma(r17801949, r17801951, r17801952);
        double r17801954 = t;
        double r17801955 = r17801953 - r17801954;
        double r17801956 = fma(r17801938, r17801947, r17801955);
        double r17801957 = -1.0;
        double r17801958 = fma(r17801957, r17801954, r17801954);
        double r17801959 = r17801956 + r17801958;
        return r17801959;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.6
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.6

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(z, \log 1 - \mathsf{fma}\left(\frac{y}{1} \cdot \frac{y}{1}, \frac{1}{2}, y \cdot 1\right), \log y \cdot x\right)}, \sqrt{\mathsf{fma}\left(z, \log 1 - \mathsf{fma}\left(\frac{y}{1} \cdot \frac{y}{1}, \frac{1}{2}, y \cdot 1\right), \log y \cdot x\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.4

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, \log 1 - \mathsf{fma}\left(\frac{y}{1} \cdot \frac{y}{1}, \frac{1}{2}, 1 \cdot y\right), x \cdot \log y - 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.4

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

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

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

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

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

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

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

Reproduce

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

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

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