Average Error: 9.0 → 0.3
Time: 9.6s
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 r419047 = x;
        double r419048 = y;
        double r419049 = log(r419048);
        double r419050 = r419047 * r419049;
        double r419051 = z;
        double r419052 = 1.0;
        double r419053 = r419052 - r419048;
        double r419054 = log(r419053);
        double r419055 = r419051 * r419054;
        double r419056 = r419050 + r419055;
        double r419057 = t;
        double r419058 = r419056 - r419057;
        return r419058;
}

double f(double x, double y, double z, double t) {
        double r419059 = y;
        double r419060 = log(r419059);
        double r419061 = x;
        double r419062 = z;
        double r419063 = 1.0;
        double r419064 = log(r419063);
        double r419065 = r419063 * r419059;
        double r419066 = 0.5;
        double r419067 = 2.0;
        double r419068 = pow(r419059, r419067);
        double r419069 = pow(r419063, r419067);
        double r419070 = r419068 / r419069;
        double r419071 = r419066 * r419070;
        double r419072 = r419065 + r419071;
        double r419073 = r419064 - r419072;
        double r419074 = r419062 * r419073;
        double r419075 = t;
        double r419076 = r419074 - r419075;
        double r419077 = fma(r419060, r419061, r419076);
        return r419077;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

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

    \[\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 2020062 +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))