Average Error: 9.2 → 0.3
Time: 21.1s
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 r283531 = x;
        double r283532 = y;
        double r283533 = log(r283532);
        double r283534 = r283531 * r283533;
        double r283535 = z;
        double r283536 = 1.0;
        double r283537 = r283536 - r283532;
        double r283538 = log(r283537);
        double r283539 = r283535 * r283538;
        double r283540 = r283534 + r283539;
        double r283541 = t;
        double r283542 = r283540 - r283541;
        return r283542;
}

double f(double x, double y, double z, double t) {
        double r283543 = x;
        double r283544 = y;
        double r283545 = log(r283544);
        double r283546 = z;
        double r283547 = 1.0;
        double r283548 = log(r283547);
        double r283549 = r283547 * r283544;
        double r283550 = r283548 - r283549;
        double r283551 = r283546 * r283550;
        double r283552 = 0.5;
        double r283553 = 2.0;
        double r283554 = pow(r283544, r283553);
        double r283555 = r283546 * r283554;
        double r283556 = pow(r283547, r283553);
        double r283557 = r283555 / r283556;
        double r283558 = r283552 * r283557;
        double r283559 = r283551 - r283558;
        double r283560 = fma(r283543, r283545, r283559);
        double r283561 = t;
        double r283562 = r283560 - r283561;
        return r283562;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

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

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

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