Average Error: 11.1 → 1.3
Time: 17.5s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
\[\mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)\]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)
double f(double x, double y, double z, double t, double a) {
        double r1092099 = x;
        double r1092100 = y;
        double r1092101 = z;
        double r1092102 = r1092100 - r1092101;
        double r1092103 = t;
        double r1092104 = r1092102 * r1092103;
        double r1092105 = a;
        double r1092106 = r1092105 - r1092101;
        double r1092107 = r1092104 / r1092106;
        double r1092108 = r1092099 + r1092107;
        return r1092108;
}

double f(double x, double y, double z, double t, double a) {
        double r1092109 = y;
        double r1092110 = z;
        double r1092111 = r1092109 - r1092110;
        double r1092112 = a;
        double r1092113 = r1092112 - r1092110;
        double r1092114 = r1092111 / r1092113;
        double r1092115 = t;
        double r1092116 = x;
        double r1092117 = fma(r1092114, r1092115, r1092116);
        return r1092117;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original11.1
Target0.5
Herbie1.3
\[\begin{array}{l} \mathbf{if}\;t \lt -1.068297449017406694366747246993994850729 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t \lt 3.911094988758637497591020599238553861375 \cdot 10^{-141}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \end{array}\]

Derivation

  1. Initial program 11.1

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

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

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

Reproduce

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

  :herbie-target
  (if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))

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