Average Error: 9.1 → 0.3
Time: 18.9s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1.0 - y\right)\right) - t\]
\[\mathsf{fma}\left(\log 1.0 - \mathsf{fma}\left(\frac{y}{1.0} \cdot \frac{y}{1.0}, \frac{1}{2}, 1.0 \cdot y\right), z, \log y \cdot x\right) - t\]
\left(x \cdot \log y + z \cdot \log \left(1.0 - y\right)\right) - t
\mathsf{fma}\left(\log 1.0 - \mathsf{fma}\left(\frac{y}{1.0} \cdot \frac{y}{1.0}, \frac{1}{2}, 1.0 \cdot y\right), z, \log y \cdot x\right) - t
double f(double x, double y, double z, double t) {
        double r7495878 = x;
        double r7495879 = y;
        double r7495880 = log(r7495879);
        double r7495881 = r7495878 * r7495880;
        double r7495882 = z;
        double r7495883 = 1.0;
        double r7495884 = r7495883 - r7495879;
        double r7495885 = log(r7495884);
        double r7495886 = r7495882 * r7495885;
        double r7495887 = r7495881 + r7495886;
        double r7495888 = t;
        double r7495889 = r7495887 - r7495888;
        return r7495889;
}

double f(double x, double y, double z, double t) {
        double r7495890 = 1.0;
        double r7495891 = log(r7495890);
        double r7495892 = y;
        double r7495893 = r7495892 / r7495890;
        double r7495894 = r7495893 * r7495893;
        double r7495895 = 0.5;
        double r7495896 = r7495890 * r7495892;
        double r7495897 = fma(r7495894, r7495895, r7495896);
        double r7495898 = r7495891 - r7495897;
        double r7495899 = z;
        double r7495900 = log(r7495892);
        double r7495901 = x;
        double r7495902 = r7495900 * r7495901;
        double r7495903 = fma(r7495898, r7495899, r7495902);
        double r7495904 = t;
        double r7495905 = r7495903 - r7495904;
        return r7495905;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

Derivation

  1. Initial program 9.1

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

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

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

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

    \[\leadsto \mathsf{fma}\left(\log 1.0 - \mathsf{fma}\left(\frac{y}{1.0} \cdot \frac{y}{1.0}, \frac{1}{2}, 1.0 \cdot y\right), z, \color{blue}{\left(\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}\right) \cdot \sqrt[3]{\log y}\right)} \cdot x\right) - t\]
  7. Applied associate-*l*0.7

    \[\leadsto \mathsf{fma}\left(\log 1.0 - \mathsf{fma}\left(\frac{y}{1.0} \cdot \frac{y}{1.0}, \frac{1}{2}, 1.0 \cdot y\right), z, \color{blue}{\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}\right) \cdot \left(\sqrt[3]{\log y} \cdot x\right)}\right) - t\]
  8. Using strategy rm
  9. Applied cbrt-unprod0.6

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

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

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

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

Reproduce

herbie shell --seed 2019156 +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) (* (/ 1/3 (* 1.0 (* 1.0 1.0))) (* y (* y y))))) (- t (* x (log y))))

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