Average Error: 9.2 → 0.3
Time: 9.9s
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, -z \cdot \left(1 \cdot y + 0.5 \cdot {y}^{2}\right)\right)\right) - t\right) + t \cdot 0\]
\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, -z \cdot \left(1 \cdot y + 0.5 \cdot {y}^{2}\right)\right)\right) - t\right) + t \cdot 0
double f(double x, double y, double z, double t) {
        double r414913 = x;
        double r414914 = y;
        double r414915 = log(r414914);
        double r414916 = r414913 * r414915;
        double r414917 = z;
        double r414918 = 1.0;
        double r414919 = r414918 - r414914;
        double r414920 = log(r414919);
        double r414921 = r414917 * r414920;
        double r414922 = r414916 + r414921;
        double r414923 = t;
        double r414924 = r414922 - r414923;
        return r414924;
}

double f(double x, double y, double z, double t) {
        double r414925 = x;
        double r414926 = y;
        double r414927 = log(r414926);
        double r414928 = z;
        double r414929 = 1.0;
        double r414930 = log(r414929);
        double r414931 = r414929 * r414926;
        double r414932 = 0.5;
        double r414933 = 2.0;
        double r414934 = pow(r414926, r414933);
        double r414935 = r414932 * r414934;
        double r414936 = r414931 + r414935;
        double r414937 = r414928 * r414936;
        double r414938 = -r414937;
        double r414939 = fma(r414928, r414930, r414938);
        double r414940 = fma(r414925, r414927, r414939);
        double r414941 = t;
        double r414942 = r414940 - r414941;
        double r414943 = 0.0;
        double r414944 = r414941 * r414943;
        double r414945 = r414942 + r414944;
        return r414945;
}

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. Taylor expanded around 0 0.3

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

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

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

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

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

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

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

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

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

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

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))