Average Error: 9.6 → 0.5
Time: 23.9s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\mathsf{fma}\left(z, \log 1 - y \cdot 1, \mathsf{fma}\left(x, \log y, -t\right)\right) + \left(t - t\right)\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(z, \log 1 - y \cdot 1, \mathsf{fma}\left(x, \log y, -t\right)\right) + \left(t - t\right)
double f(double x, double y, double z, double t) {
        double r23391121 = x;
        double r23391122 = y;
        double r23391123 = log(r23391122);
        double r23391124 = r23391121 * r23391123;
        double r23391125 = z;
        double r23391126 = 1.0;
        double r23391127 = r23391126 - r23391122;
        double r23391128 = log(r23391127);
        double r23391129 = r23391125 * r23391128;
        double r23391130 = r23391124 + r23391129;
        double r23391131 = t;
        double r23391132 = r23391130 - r23391131;
        return r23391132;
}

double f(double x, double y, double z, double t) {
        double r23391133 = z;
        double r23391134 = 1.0;
        double r23391135 = log(r23391134);
        double r23391136 = y;
        double r23391137 = r23391136 * r23391134;
        double r23391138 = r23391135 - r23391137;
        double r23391139 = x;
        double r23391140 = log(r23391136);
        double r23391141 = t;
        double r23391142 = -r23391141;
        double r23391143 = fma(r23391139, r23391140, r23391142);
        double r23391144 = fma(r23391133, r23391138, r23391143);
        double r23391145 = r23391141 - r23391141;
        double r23391146 = r23391144 + r23391145;
        return r23391146;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.6
Target0.2
Herbie0.5
\[\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(x, \log y, z \cdot \log \left(1 - y\right)\right) - t}\]
  3. Taylor expanded around 0 0.5

    \[\leadsto \color{blue}{\left(\left(\log 1 \cdot z + x \cdot \log y\right) - 1 \cdot \left(z \cdot y\right)\right)} - t\]
  4. Simplified0.5

    \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, z \cdot \left(\log 1 - y \cdot 1\right)\right)} - t\]
  5. Using strategy rm
  6. Applied add-cube-cbrt1.0

    \[\leadsto \mathsf{fma}\left(\log y, x, z \cdot \left(\log 1 - y \cdot 1\right)\right) - \color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}\]
  7. Applied add-sqr-sqrt32.9

    \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(\log y, x, z \cdot \left(\log 1 - y \cdot 1\right)\right)} \cdot \sqrt{\mathsf{fma}\left(\log y, x, z \cdot \left(\log 1 - y \cdot 1\right)\right)}} - \left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}\]
  8. Applied prod-diff32.9

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\log y, x, z \cdot \left(\log 1 - y \cdot 1\right)\right)}, \sqrt{\mathsf{fma}\left(\log y, x, z \cdot \left(\log 1 - y \cdot 1\right)\right)}, -\sqrt[3]{t} \cdot \left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{t}, \sqrt[3]{t} \cdot \sqrt[3]{t}, \sqrt[3]{t} \cdot \left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right)\right)}\]
  9. Simplified0.5

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, \log 1 - y \cdot 1, x \cdot \log y - t\right)} + \mathsf{fma}\left(-\sqrt[3]{t}, \sqrt[3]{t} \cdot \sqrt[3]{t}, \sqrt[3]{t} \cdot \left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right)\right)\]
  10. Simplified0.5

    \[\leadsto \mathsf{fma}\left(z, \log 1 - y \cdot 1, x \cdot \log y - t\right) + \color{blue}{\left(t - t\right)}\]
  11. Using strategy rm
  12. Applied fma-neg0.5

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

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

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"

  :herbie-target
  (- (* (- z) (+ (+ (* 0.5 (* y y)) y) (* (/ 0.3333333333333333 (* 1.0 (* 1.0 1.0))) (* y (* y y))))) (- t (* x (log y))))

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