Average Error: 1.3 → 1.3
Time: 9.3s
Precision: 64
\[x + y \cdot \frac{z - t}{a - t}\]
\[\mathsf{fma}\left(\frac{1}{\frac{a - t}{z - t}}, y, x\right)\]
x + y \cdot \frac{z - t}{a - t}
\mathsf{fma}\left(\frac{1}{\frac{a - t}{z - t}}, y, x\right)
double f(double x, double y, double z, double t, double a) {
        double r616913 = x;
        double r616914 = y;
        double r616915 = z;
        double r616916 = t;
        double r616917 = r616915 - r616916;
        double r616918 = a;
        double r616919 = r616918 - r616916;
        double r616920 = r616917 / r616919;
        double r616921 = r616914 * r616920;
        double r616922 = r616913 + r616921;
        return r616922;
}

double f(double x, double y, double z, double t, double a) {
        double r616923 = 1.0;
        double r616924 = a;
        double r616925 = t;
        double r616926 = r616924 - r616925;
        double r616927 = z;
        double r616928 = r616927 - r616925;
        double r616929 = r616926 / r616928;
        double r616930 = r616923 / r616929;
        double r616931 = y;
        double r616932 = x;
        double r616933 = fma(r616930, r616931, r616932);
        return r616933;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original1.3
Target0.3
Herbie1.3
\[\begin{array}{l} \mathbf{if}\;y \lt -8.50808486055124107 \cdot 10^{-17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y \lt 2.8944268627920891 \cdot 10^{-49}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \end{array}\]

Derivation

  1. Initial program 1.3

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z - t}{a - t}, y, x\right)}\]
  3. Using strategy rm
  4. Applied clear-num1.3

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

    \[\leadsto \mathsf{fma}\left(\frac{1}{\frac{a - t}{z - t}}, y, 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, B"
  :precision binary64

  :herbie-target
  (if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))

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