Average Error: 1.4 → 1.4
Time: 7.0s
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 r1129146 = x;
        double r1129147 = y;
        double r1129148 = z;
        double r1129149 = t;
        double r1129150 = r1129148 - r1129149;
        double r1129151 = a;
        double r1129152 = r1129148 - r1129151;
        double r1129153 = r1129150 / r1129152;
        double r1129154 = r1129147 * r1129153;
        double r1129155 = r1129146 + r1129154;
        return r1129155;
}

double f(double x, double y, double z, double t, double a) {
        double r1129156 = y;
        double r1129157 = z;
        double r1129158 = t;
        double r1129159 = r1129157 - r1129158;
        double r1129160 = a;
        double r1129161 = r1129157 - r1129160;
        double r1129162 = r1129159 / r1129161;
        double r1129163 = x;
        double r1129164 = fma(r1129156, r1129162, r1129163);
        return r1129164;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

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

Derivation

  1. Initial program 1.4

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

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

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

Reproduce

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