Average Error: 0.1 → 0.1
Time: 6.4s
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, \mathsf{fma}\left(z, 1 - \log t, x + y\right)\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, \mathsf{fma}\left(z, 1 - \log t, x + y\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r478002 = x;
        double r478003 = y;
        double r478004 = r478002 + r478003;
        double r478005 = z;
        double r478006 = r478004 + r478005;
        double r478007 = t;
        double r478008 = log(r478007);
        double r478009 = r478005 * r478008;
        double r478010 = r478006 - r478009;
        double r478011 = a;
        double r478012 = 0.5;
        double r478013 = r478011 - r478012;
        double r478014 = b;
        double r478015 = r478013 * r478014;
        double r478016 = r478010 + r478015;
        return r478016;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r478017 = b;
        double r478018 = a;
        double r478019 = 0.5;
        double r478020 = r478018 - r478019;
        double r478021 = z;
        double r478022 = 1.0;
        double r478023 = t;
        double r478024 = log(r478023);
        double r478025 = r478022 - r478024;
        double r478026 = x;
        double r478027 = y;
        double r478028 = r478026 + r478027;
        double r478029 = fma(r478021, r478025, r478028);
        double r478030 = fma(r478017, r478020, r478029);
        return r478030;
}

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.3
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(b, a - 0.5, \left(\left(x + y\right) + z\right) - z \cdot \log t\right)}\]
  3. Taylor expanded around 0 0.1

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

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

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

Reproduce

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