Average Error: 1.9 → 1.9
Time: 47.3s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)\]
x + \left(y - x\right) \cdot \frac{z}{t}
\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)
double f(double x, double y, double z, double t) {
        double r23552329 = x;
        double r23552330 = y;
        double r23552331 = r23552330 - r23552329;
        double r23552332 = z;
        double r23552333 = t;
        double r23552334 = r23552332 / r23552333;
        double r23552335 = r23552331 * r23552334;
        double r23552336 = r23552329 + r23552335;
        return r23552336;
}

double f(double x, double y, double z, double t) {
        double r23552337 = z;
        double r23552338 = t;
        double r23552339 = r23552337 / r23552338;
        double r23552340 = y;
        double r23552341 = x;
        double r23552342 = r23552340 - r23552341;
        double r23552343 = fma(r23552339, r23552342, r23552341);
        return r23552343;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original1.9
Target2.0
Herbie1.9
\[\begin{array}{l} \mathbf{if}\;\left(y - x\right) \cdot \frac{z}{t} \lt -1013646692435.88671875:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;\left(y - x\right) \cdot \frac{z}{t} \lt -0.0:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Derivation

  1. Initial program 1.9

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

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

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

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"

  :herbie-target
  (if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) -0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))

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