Average Error: 0.1 → 0.1
Time: 30.6s
Precision: 64
\[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\]
\[\mathsf{fma}\left(b, a - 0.5, z - \log t \cdot z\right) + \left(x + y\right)\]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\mathsf{fma}\left(b, a - 0.5, z - \log t \cdot z\right) + \left(x + y\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r249274 = x;
        double r249275 = y;
        double r249276 = r249274 + r249275;
        double r249277 = z;
        double r249278 = r249276 + r249277;
        double r249279 = t;
        double r249280 = log(r249279);
        double r249281 = r249277 * r249280;
        double r249282 = r249278 - r249281;
        double r249283 = a;
        double r249284 = 0.5;
        double r249285 = r249283 - r249284;
        double r249286 = b;
        double r249287 = r249285 * r249286;
        double r249288 = r249282 + r249287;
        return r249288;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r249289 = b;
        double r249290 = a;
        double r249291 = 0.5;
        double r249292 = r249290 - r249291;
        double r249293 = z;
        double r249294 = t;
        double r249295 = log(r249294);
        double r249296 = r249295 * r249293;
        double r249297 = r249293 - r249296;
        double r249298 = fma(r249289, r249292, r249297);
        double r249299 = x;
        double r249300 = y;
        double r249301 = r249299 + r249300;
        double r249302 = r249298 + r249301;
        return r249302;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Target

Original0.1
Target0.4
Herbie0.1
\[\left(\left(x + y\right) + \frac{\left(1 - {\left(\log t\right)}^{2}\right) \cdot z}{1 + \log t}\right) + \left(a - 0.5\right) \cdot b\]

Derivation

  1. Initial program 0.1

    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, 1 - \log t, \mathsf{fma}\left(a - 0.5, b, x + y\right)\right)}\]
  3. Using strategy rm
  4. Applied fma-udef0.1

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

    \[\leadsto \color{blue}{\left(z - \log t \cdot z\right)} + \mathsf{fma}\left(a - 0.5, b, x + y\right)\]
  6. Using strategy rm
  7. Applied add-sqr-sqrt32.7

    \[\leadsto \left(\color{blue}{\sqrt{z} \cdot \sqrt{z}} - \log t \cdot z\right) + \mathsf{fma}\left(a - 0.5, b, x + y\right)\]
  8. Applied prod-diff32.7

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

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

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

    \[\leadsto \left(z \cdot \left(1 - \log t\right) + \left(\log t \cdot 0\right) \cdot z\right) + \color{blue}{\left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right)}\]
  13. Applied associate-+r+0.1

    \[\leadsto \color{blue}{\left(\left(z \cdot \left(1 - \log t\right) + \left(\log t \cdot 0\right) \cdot z\right) + \left(a - 0.5\right) \cdot b\right) + \left(x + y\right)}\]
  14. Simplified0.1

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

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

Reproduce

herbie shell --seed 2019303 +o rules:numerics
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (+ (+ (+ x y) (/ (* (- 1 (pow (log t) 2)) z) (+ 1 (log t)))) (* (- a 0.5) b))

  (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))