Average Error: 10.0 → 0.3
Time: 10.9s
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)\right) + \left(-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)\right) + \left(-t\right)
double f(double x, double y, double z, double t) {
        double r1115113 = x;
        double r1115114 = y;
        double r1115115 = log(r1115114);
        double r1115116 = r1115113 * r1115115;
        double r1115117 = z;
        double r1115118 = 1.0;
        double r1115119 = r1115118 - r1115114;
        double r1115120 = log(r1115119);
        double r1115121 = r1115117 * r1115120;
        double r1115122 = r1115116 + r1115121;
        double r1115123 = t;
        double r1115124 = r1115122 - r1115123;
        return r1115124;
}

double f(double x, double y, double z, double t) {
        double r1115125 = y;
        double r1115126 = log(r1115125);
        double r1115127 = x;
        double r1115128 = z;
        double r1115129 = 1.0;
        double r1115130 = log(r1115129);
        double r1115131 = r1115129 * r1115125;
        double r1115132 = 0.5;
        double r1115133 = 2.0;
        double r1115134 = pow(r1115125, r1115133);
        double r1115135 = pow(r1115129, r1115133);
        double r1115136 = r1115134 / r1115135;
        double r1115137 = r1115132 * r1115136;
        double r1115138 = r1115131 + r1115137;
        double r1115139 = r1115130 - r1115138;
        double r1115140 = r1115128 * r1115139;
        double r1115141 = fma(r1115126, r1115127, r1115140);
        double r1115142 = t;
        double r1115143 = -r1115142;
        double r1115144 = r1115141 + r1115143;
        return r1115144;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original10.0
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 10.0

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

    \[\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. Using strategy rm
  5. Applied fma-udef0.3

    \[\leadsto \color{blue}{\log y \cdot x + \left(z \cdot \left(\log 1 - \left(1 \cdot y + \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right) - t\right)}\]
  6. Using strategy rm
  7. Applied sub-neg0.3

    \[\leadsto \log y \cdot x + \color{blue}{\left(z \cdot \left(\log 1 - \left(1 \cdot y + \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right) + \left(-t\right)\right)}\]
  8. Applied associate-+r+0.3

    \[\leadsto \color{blue}{\left(\log y \cdot x + z \cdot \left(\log 1 - \left(1 \cdot y + \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right)\right) + \left(-t\right)}\]
  9. Simplified0.3

    \[\leadsto \color{blue}{\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)\right)} + \left(-t\right)\]
  10. 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)\right) + \left(-t\right)\]

Reproduce

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