Average Error: 9.9 → 0.3
Time: 23.7s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\mathsf{fma}\left(x, \log y, \mathsf{fma}\left(\frac{-1}{2}, \frac{z \cdot {y}^{2}}{{1}^{2}}, z \cdot \left(\log 1 - 1 \cdot y\right)\right)\right) - t\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(x, \log y, \mathsf{fma}\left(\frac{-1}{2}, \frac{z \cdot {y}^{2}}{{1}^{2}}, z \cdot \left(\log 1 - 1 \cdot y\right)\right)\right) - t
double f(double x, double y, double z, double t) {
        double r285470 = x;
        double r285471 = y;
        double r285472 = log(r285471);
        double r285473 = r285470 * r285472;
        double r285474 = z;
        double r285475 = 1.0;
        double r285476 = r285475 - r285471;
        double r285477 = log(r285476);
        double r285478 = r285474 * r285477;
        double r285479 = r285473 + r285478;
        double r285480 = t;
        double r285481 = r285479 - r285480;
        return r285481;
}

double f(double x, double y, double z, double t) {
        double r285482 = x;
        double r285483 = y;
        double r285484 = log(r285483);
        double r285485 = -0.5;
        double r285486 = z;
        double r285487 = 2.0;
        double r285488 = pow(r285483, r285487);
        double r285489 = r285486 * r285488;
        double r285490 = 1.0;
        double r285491 = pow(r285490, r285487);
        double r285492 = r285489 / r285491;
        double r285493 = log(r285490);
        double r285494 = r285490 * r285483;
        double r285495 = r285493 - r285494;
        double r285496 = r285486 * r285495;
        double r285497 = fma(r285485, r285492, r285496);
        double r285498 = fma(r285482, r285484, r285497);
        double r285499 = t;
        double r285500 = r285498 - r285499;
        return r285500;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

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

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

    \[\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.3

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

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

Reproduce

herbie shell --seed 2019303 +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.333333333333333315 (* 1 (* 1 1))) (* y (* y y))))) (- t (* x (log y))))

  (- (+ (* x (log y)) (* z (log (- 1 y)))) t))