Average Error: 24.4 → 11.5
Time: 12.4s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[x + \frac{y - x}{\frac{a - t}{z - t}}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
x + \frac{y - x}{\frac{a - t}{z - t}}
double f(double x, double y, double z, double t, double a) {
        double r472349 = x;
        double r472350 = y;
        double r472351 = r472350 - r472349;
        double r472352 = z;
        double r472353 = t;
        double r472354 = r472352 - r472353;
        double r472355 = r472351 * r472354;
        double r472356 = a;
        double r472357 = r472356 - r472353;
        double r472358 = r472355 / r472357;
        double r472359 = r472349 + r472358;
        return r472359;
}

double f(double x, double y, double z, double t, double a) {
        double r472360 = x;
        double r472361 = y;
        double r472362 = r472361 - r472360;
        double r472363 = a;
        double r472364 = t;
        double r472365 = r472363 - r472364;
        double r472366 = z;
        double r472367 = r472366 - r472364;
        double r472368 = r472365 / r472367;
        double r472369 = r472362 / r472368;
        double r472370 = r472360 + r472369;
        return r472370;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original24.4
Target9.2
Herbie11.5
\[\begin{array}{l} \mathbf{if}\;a \lt -1.6153062845442575 \cdot 10^{-142}:\\ \;\;\;\;x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;a \lt 3.7744031700831742 \cdot 10^{-182}:\\ \;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\ \end{array}\]

Derivation

  1. Initial program 24.4

    \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
  2. Using strategy rm
  3. Applied associate-/l*11.5

    \[\leadsto x + \color{blue}{\frac{y - x}{\frac{a - t}{z - t}}}\]
  4. Final simplification11.5

    \[\leadsto x + \frac{y - x}{\frac{a - t}{z - t}}\]

Reproduce

herbie shell --seed 2020089 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< a -1.6153062845442575e-142) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t))))))

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