Average Error: 9.7 → 0.4
Time: 19.0s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\left(x \cdot \log \left(\sqrt[3]{y}\right) - \mathsf{fma}\left(z \cdot y, \mathsf{fma}\left(0.5, y, 1\right), t\right)\right) + \log \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\left(x \cdot \log \left(\sqrt[3]{y}\right) - \mathsf{fma}\left(z \cdot y, \mathsf{fma}\left(0.5, y, 1\right), t\right)\right) + \log \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x
double f(double x, double y, double z, double t) {
        double r14591981 = x;
        double r14591982 = y;
        double r14591983 = log(r14591982);
        double r14591984 = r14591981 * r14591983;
        double r14591985 = z;
        double r14591986 = 1.0;
        double r14591987 = r14591986 - r14591982;
        double r14591988 = log(r14591987);
        double r14591989 = r14591985 * r14591988;
        double r14591990 = r14591984 + r14591989;
        double r14591991 = t;
        double r14591992 = r14591990 - r14591991;
        return r14591992;
}

double f(double x, double y, double z, double t) {
        double r14591993 = x;
        double r14591994 = y;
        double r14591995 = cbrt(r14591994);
        double r14591996 = log(r14591995);
        double r14591997 = r14591993 * r14591996;
        double r14591998 = z;
        double r14591999 = r14591998 * r14591994;
        double r14592000 = 0.5;
        double r14592001 = 1.0;
        double r14592002 = fma(r14592000, r14591994, r14592001);
        double r14592003 = t;
        double r14592004 = fma(r14591999, r14592002, r14592003);
        double r14592005 = r14591997 - r14592004;
        double r14592006 = r14591995 * r14591995;
        double r14592007 = log(r14592006);
        double r14592008 = r14592007 * r14591993;
        double r14592009 = r14592005 + r14592008;
        return r14592009;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

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

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

    \[\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.3

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

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

    \[\leadsto \color{blue}{\left(x \cdot \log y - \mathsf{fma}\left(1, y \cdot z, \left(0.5 \cdot y\right) \cdot \left(y \cdot z\right)\right)\right)} - t\]
  7. Using strategy rm
  8. Applied add-cube-cbrt0.3

    \[\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(1, y \cdot z, \left(0.5 \cdot y\right) \cdot \left(y \cdot z\right)\right)\right) - t\]
  9. 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(1, y \cdot z, \left(0.5 \cdot y\right) \cdot \left(y \cdot z\right)\right)\right) - t\]
  10. Applied distribute-lft-in0.3

    \[\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(1, y \cdot z, \left(0.5 \cdot y\right) \cdot \left(y \cdot z\right)\right)\right) - t\]
  11. Applied associate--l+0.3

    \[\leadsto \color{blue}{\left(x \cdot \log \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) + \left(x \cdot \log \left(\sqrt[3]{y}\right) - \mathsf{fma}\left(1, y \cdot z, \left(0.5 \cdot y\right) \cdot \left(y \cdot z\right)\right)\right)\right)} - t\]
  12. Applied associate--l+0.4

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

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

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

Reproduce

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