Average Error: 1.4 → 1.4
Time: 13.9s
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 r2658 = x;
        double r2659 = y;
        double r2660 = z;
        double r2661 = t;
        double r2662 = r2660 - r2661;
        double r2663 = a;
        double r2664 = r2660 - r2663;
        double r2665 = r2662 / r2664;
        double r2666 = r2659 * r2665;
        double r2667 = r2658 + r2666;
        return r2667;
}

double f(double x, double y, double z, double t, double a) {
        double r2668 = y;
        double r2669 = z;
        double r2670 = t;
        double r2671 = r2669 - r2670;
        double r2672 = a;
        double r2673 = r2669 - r2672;
        double r2674 = r2671 / r2673;
        double r2675 = x;
        double r2676 = fma(r2668, r2674, r2675);
        return r2676;
}

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)))))