Average Error: 9.2 → 0.3
Time: 33.8s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\mathsf{fma}\left(\log y, x, \mathsf{fma}\left(\mathsf{fma}\left(\frac{y}{1} \cdot \frac{y}{1}, \frac{-1}{2}, \mathsf{fma}\left(-y, 1, \log 1\right)\right), z, -t\right)\right)\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(\log y, x, \mathsf{fma}\left(\mathsf{fma}\left(\frac{y}{1} \cdot \frac{y}{1}, \frac{-1}{2}, \mathsf{fma}\left(-y, 1, \log 1\right)\right), z, -t\right)\right)
double f(double x, double y, double z, double t) {
        double r404044 = x;
        double r404045 = y;
        double r404046 = log(r404045);
        double r404047 = r404044 * r404046;
        double r404048 = z;
        double r404049 = 1.0;
        double r404050 = r404049 - r404045;
        double r404051 = log(r404050);
        double r404052 = r404048 * r404051;
        double r404053 = r404047 + r404052;
        double r404054 = t;
        double r404055 = r404053 - r404054;
        return r404055;
}

double f(double x, double y, double z, double t) {
        double r404056 = y;
        double r404057 = log(r404056);
        double r404058 = x;
        double r404059 = 1.0;
        double r404060 = r404056 / r404059;
        double r404061 = r404060 * r404060;
        double r404062 = -0.5;
        double r404063 = -r404056;
        double r404064 = log(r404059);
        double r404065 = fma(r404063, r404059, r404064);
        double r404066 = fma(r404061, r404062, r404065);
        double r404067 = z;
        double r404068 = t;
        double r404069 = -r404068;
        double r404070 = fma(r404066, r404067, r404069);
        double r404071 = fma(r404057, r404058, r404070);
        return r404071;
}

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

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

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

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

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

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

Reproduce

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