Average Error: 9.4 → 0.3
Time: 8.0s
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(1, \frac{{y}^{3} \cdot z}{{1}^{2}}, -\mathsf{fma}\left(1, z \cdot y, \mathsf{fma}\left(1.33333333333333326, z \cdot {y}^{3}, 0.5 \cdot \left(z \cdot {y}^{2}\right)\right)\right)\right) - t\right)\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(\log y, x, \mathsf{fma}\left(1, \frac{{y}^{3} \cdot z}{{1}^{2}}, -\mathsf{fma}\left(1, z \cdot y, \mathsf{fma}\left(1.33333333333333326, z \cdot {y}^{3}, 0.5 \cdot \left(z \cdot {y}^{2}\right)\right)\right)\right) - t\right)
double f(double x, double y, double z, double t) {
        double r382568 = x;
        double r382569 = y;
        double r382570 = log(r382569);
        double r382571 = r382568 * r382570;
        double r382572 = z;
        double r382573 = 1.0;
        double r382574 = r382573 - r382569;
        double r382575 = log(r382574);
        double r382576 = r382572 * r382575;
        double r382577 = r382571 + r382576;
        double r382578 = t;
        double r382579 = r382577 - r382578;
        return r382579;
}

double f(double x, double y, double z, double t) {
        double r382580 = y;
        double r382581 = log(r382580);
        double r382582 = x;
        double r382583 = 1.0;
        double r382584 = 3.0;
        double r382585 = pow(r382580, r382584);
        double r382586 = z;
        double r382587 = r382585 * r382586;
        double r382588 = 2.0;
        double r382589 = pow(r382583, r382588);
        double r382590 = r382587 / r382589;
        double r382591 = r382586 * r382580;
        double r382592 = 1.3333333333333333;
        double r382593 = r382586 * r382585;
        double r382594 = 0.5;
        double r382595 = pow(r382580, r382588);
        double r382596 = r382586 * r382595;
        double r382597 = r382594 * r382596;
        double r382598 = fma(r382592, r382593, r382597);
        double r382599 = fma(r382583, r382591, r382598);
        double r382600 = -r382599;
        double r382601 = fma(r382583, r382590, r382600);
        double r382602 = t;
        double r382603 = r382601 - r382602;
        double r382604 = fma(r382581, r382582, r382603);
        return r382604;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.4
Target0.3
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.4

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, z \cdot \log \left(1 - y\right) - t\right)}\]
  3. Using strategy rm
  4. Applied flip3--9.4

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

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

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

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

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

Reproduce

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