Average Error: 0.1 → 0.1
Time: 5.3s
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 r444823 = x;
        double r444824 = y;
        double r444825 = r444823 + r444824;
        double r444826 = z;
        double r444827 = r444825 + r444826;
        double r444828 = t;
        double r444829 = log(r444828);
        double r444830 = r444826 * r444829;
        double r444831 = r444827 - r444830;
        double r444832 = a;
        double r444833 = 0.5;
        double r444834 = r444832 - r444833;
        double r444835 = b;
        double r444836 = r444834 * r444835;
        double r444837 = r444831 + r444836;
        return r444837;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r444838 = b;
        double r444839 = a;
        double r444840 = 0.5;
        double r444841 = r444839 - r444840;
        double r444842 = z;
        double r444843 = 1.0;
        double r444844 = t;
        double r444845 = log(r444844);
        double r444846 = r444843 - r444845;
        double r444847 = x;
        double r444848 = y;
        double r444849 = r444847 + r444848;
        double r444850 = fma(r444842, r444846, r444849);
        double r444851 = fma(r444838, r444841, r444850);
        return r444851;
}

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(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 2020060 +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)))