Average Error: 1.2 → 1.2
Time: 5.1s
Precision: 64
\[x + y \cdot \frac{z - t}{z - a}\]
\[\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)\]
x + y \cdot \frac{z - t}{z - a}
\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)
double f(double x, double y, double z, double t, double a) {
        double r592040 = x;
        double r592041 = y;
        double r592042 = z;
        double r592043 = t;
        double r592044 = r592042 - r592043;
        double r592045 = a;
        double r592046 = r592042 - r592045;
        double r592047 = r592044 / r592046;
        double r592048 = r592041 * r592047;
        double r592049 = r592040 + r592048;
        return r592049;
}

double f(double x, double y, double z, double t, double a) {
        double r592050 = y;
        double r592051 = z;
        double r592052 = t;
        double r592053 = r592051 - r592052;
        double r592054 = a;
        double r592055 = r592051 - r592054;
        double r592056 = r592053 / r592055;
        double r592057 = x;
        double r592058 = fma(r592050, r592056, r592057);
        return r592058;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original1.2
Target1.1
Herbie1.2
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Initial program 1.2

    \[x + y \cdot \frac{z - t}{z - a}\]
  2. Simplified1.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)}\]
  3. Final simplification1.2

    \[\leadsto \mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)\]

Reproduce

herbie shell --seed 2020046 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
  :precision binary64

  :herbie-target
  (+ x (/ y (/ (- z a) (- z t))))

  (+ x (* y (/ (- z t) (- z a)))))