Average Error: 9.7 → 0.3
Time: 9.5s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\mathsf{fma}\left(\log y, x, z \cdot \left(\log 1 - \left(1 \cdot y + \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right) - t\right)\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(\log y, x, z \cdot \left(\log 1 - \left(1 \cdot y + \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right) - t\right)
double f(double x, double y, double z, double t) {
        double r433857 = x;
        double r433858 = y;
        double r433859 = log(r433858);
        double r433860 = r433857 * r433859;
        double r433861 = z;
        double r433862 = 1.0;
        double r433863 = r433862 - r433858;
        double r433864 = log(r433863);
        double r433865 = r433861 * r433864;
        double r433866 = r433860 + r433865;
        double r433867 = t;
        double r433868 = r433866 - r433867;
        return r433868;
}

double f(double x, double y, double z, double t) {
        double r433869 = y;
        double r433870 = log(r433869);
        double r433871 = x;
        double r433872 = z;
        double r433873 = 1.0;
        double r433874 = log(r433873);
        double r433875 = r433873 * r433869;
        double r433876 = 0.5;
        double r433877 = 2.0;
        double r433878 = pow(r433869, r433877);
        double r433879 = pow(r433873, r433877);
        double r433880 = r433878 / r433879;
        double r433881 = r433876 * r433880;
        double r433882 = r433875 + r433881;
        double r433883 = r433874 - r433882;
        double r433884 = r433872 * r433883;
        double r433885 = t;
        double r433886 = r433884 - r433885;
        double r433887 = fma(r433870, r433871, r433886);
        return r433887;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

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

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

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

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

Reproduce

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