Average Error: 9.6 → 0.3
Time: 11.0s
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 r438463 = x;
        double r438464 = y;
        double r438465 = log(r438464);
        double r438466 = r438463 * r438465;
        double r438467 = z;
        double r438468 = 1.0;
        double r438469 = r438468 - r438464;
        double r438470 = log(r438469);
        double r438471 = r438467 * r438470;
        double r438472 = r438466 + r438471;
        double r438473 = t;
        double r438474 = r438472 - r438473;
        return r438474;
}

double f(double x, double y, double z, double t) {
        double r438475 = y;
        double r438476 = log(r438475);
        double r438477 = x;
        double r438478 = z;
        double r438479 = 1.0;
        double r438480 = log(r438479);
        double r438481 = r438479 * r438475;
        double r438482 = 0.5;
        double r438483 = 2.0;
        double r438484 = pow(r438475, r438483);
        double r438485 = pow(r438479, r438483);
        double r438486 = r438484 / r438485;
        double r438487 = r438482 * r438486;
        double r438488 = r438481 + r438487;
        double r438489 = r438480 - r438488;
        double r438490 = r438478 * r438489;
        double r438491 = t;
        double r438492 = r438490 - r438491;
        double r438493 = fma(r438476, r438477, r438492);
        return r438493;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

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

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