Average Error: 1.3 → 1.3
Time: 57.3s
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 r27091335 = x;
        double r27091336 = y;
        double r27091337 = z;
        double r27091338 = t;
        double r27091339 = r27091337 - r27091338;
        double r27091340 = a;
        double r27091341 = r27091337 - r27091340;
        double r27091342 = r27091339 / r27091341;
        double r27091343 = r27091336 * r27091342;
        double r27091344 = r27091335 + r27091343;
        return r27091344;
}

double f(double x, double y, double z, double t, double a) {
        double r27091345 = y;
        double r27091346 = z;
        double r27091347 = t;
        double r27091348 = r27091346 - r27091347;
        double r27091349 = a;
        double r27091350 = r27091346 - r27091349;
        double r27091351 = r27091348 / r27091350;
        double r27091352 = x;
        double r27091353 = fma(r27091345, r27091351, r27091352);
        return r27091353;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

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

Derivation

  1. Initial program 1.3

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

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

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

Reproduce

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

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

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