Average Error: 9.8 → 0.4
Time: 13.5s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\mathsf{fma}\left(x, \log y, z \cdot \left(\log 1 - 1 \cdot y\right) - \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right) - t\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(x, \log y, z \cdot \left(\log 1 - 1 \cdot y\right) - \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right) - t
double f(double x, double y, double z, double t) {
        double r406594 = x;
        double r406595 = y;
        double r406596 = log(r406595);
        double r406597 = r406594 * r406596;
        double r406598 = z;
        double r406599 = 1.0;
        double r406600 = r406599 - r406595;
        double r406601 = log(r406600);
        double r406602 = r406598 * r406601;
        double r406603 = r406597 + r406602;
        double r406604 = t;
        double r406605 = r406603 - r406604;
        return r406605;
}

double f(double x, double y, double z, double t) {
        double r406606 = x;
        double r406607 = y;
        double r406608 = log(r406607);
        double r406609 = z;
        double r406610 = 1.0;
        double r406611 = log(r406610);
        double r406612 = r406610 * r406607;
        double r406613 = r406611 - r406612;
        double r406614 = r406609 * r406613;
        double r406615 = 0.5;
        double r406616 = 2.0;
        double r406617 = pow(r406607, r406616);
        double r406618 = r406609 * r406617;
        double r406619 = pow(r406610, r406616);
        double r406620 = r406618 / r406619;
        double r406621 = r406615 * r406620;
        double r406622 = r406614 - r406621;
        double r406623 = fma(r406606, r406608, r406622);
        double r406624 = t;
        double r406625 = r406623 - r406624;
        return r406625;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.8
Target0.3
Herbie0.4
\[\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.8

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

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

    \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{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) - t\]
  4. Simplified0.4

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

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

Reproduce

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