Average Error: 1.4 → 1.4
Time: 12.7s
Precision: 64
\[x + y \cdot \frac{z - t}{z - a}\]
\[\mathsf{fma}\left(\frac{z - t}{z - a}, y, x\right)\]
x + y \cdot \frac{z - t}{z - a}
\mathsf{fma}\left(\frac{z - t}{z - a}, y, x\right)
double f(double x, double y, double z, double t, double a) {
        double r242426 = x;
        double r242427 = y;
        double r242428 = z;
        double r242429 = t;
        double r242430 = r242428 - r242429;
        double r242431 = a;
        double r242432 = r242428 - r242431;
        double r242433 = r242430 / r242432;
        double r242434 = r242427 * r242433;
        double r242435 = r242426 + r242434;
        return r242435;
}

double f(double x, double y, double z, double t, double a) {
        double r242436 = z;
        double r242437 = t;
        double r242438 = r242436 - r242437;
        double r242439 = a;
        double r242440 = r242436 - r242439;
        double r242441 = r242438 / r242440;
        double r242442 = y;
        double r242443 = x;
        double r242444 = fma(r242441, r242442, r242443);
        return r242444;
}

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.2
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(\frac{z - t}{z - a}, y, x\right)}\]
  3. Using strategy rm
  4. Applied div-inv1.4

    \[\leadsto \mathsf{fma}\left(\color{blue}{\left(z - t\right) \cdot \frac{1}{z - a}}, y, x\right)\]
  5. Using strategy rm
  6. Applied pow11.4

    \[\leadsto \mathsf{fma}\left(\left(z - t\right) \cdot \color{blue}{{\left(\frac{1}{z - a}\right)}^{1}}, y, x\right)\]
  7. Applied pow11.4

    \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(z - t\right)}^{1}} \cdot {\left(\frac{1}{z - a}\right)}^{1}, y, x\right)\]
  8. Applied pow-prod-down1.4

    \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\left(z - t\right) \cdot \frac{1}{z - a}\right)}^{1}}, y, x\right)\]
  9. Simplified1.4

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

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

Reproduce

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