Average Error: 24.0 → 10.4
Time: 26.8s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le 7.138856904617573736839661174627961894213 \cdot 10^{-300}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 7.094564478841642016435598054575819343262 \cdot 10^{-150}:\\ \;\;\;\;\left(y + \frac{z \cdot x}{t}\right) - \frac{y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le 7.138856904617573736839661174627961894213 \cdot 10^{-300}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\

\mathbf{elif}\;a \le 7.094564478841642016435598054575819343262 \cdot 10^{-150}:\\
\;\;\;\;\left(y + \frac{z \cdot x}{t}\right) - \frac{y \cdot z}{t}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r29873333 = x;
        double r29873334 = y;
        double r29873335 = r29873334 - r29873333;
        double r29873336 = z;
        double r29873337 = t;
        double r29873338 = r29873336 - r29873337;
        double r29873339 = r29873335 * r29873338;
        double r29873340 = a;
        double r29873341 = r29873340 - r29873337;
        double r29873342 = r29873339 / r29873341;
        double r29873343 = r29873333 + r29873342;
        return r29873343;
}

double f(double x, double y, double z, double t, double a) {
        double r29873344 = a;
        double r29873345 = 7.138856904617574e-300;
        bool r29873346 = r29873344 <= r29873345;
        double r29873347 = x;
        double r29873348 = y;
        double r29873349 = r29873348 - r29873347;
        double r29873350 = t;
        double r29873351 = r29873344 - r29873350;
        double r29873352 = z;
        double r29873353 = r29873352 - r29873350;
        double r29873354 = r29873351 / r29873353;
        double r29873355 = r29873349 / r29873354;
        double r29873356 = r29873347 + r29873355;
        double r29873357 = 7.094564478841642e-150;
        bool r29873358 = r29873344 <= r29873357;
        double r29873359 = r29873352 * r29873347;
        double r29873360 = r29873359 / r29873350;
        double r29873361 = r29873348 + r29873360;
        double r29873362 = r29873348 * r29873352;
        double r29873363 = r29873362 / r29873350;
        double r29873364 = r29873361 - r29873363;
        double r29873365 = r29873358 ? r29873364 : r29873356;
        double r29873366 = r29873346 ? r29873356 : r29873365;
        return r29873366;
}

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.0
Target8.5
Herbie10.4
\[\begin{array}{l} \mathbf{if}\;a \lt -1.615306284544257464183904494091872805513 \cdot 10^{-142}:\\ \;\;\;\;x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;a \lt 3.774403170083174201868024161554637965035 \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. Split input into 2 regimes
  2. if a < 7.138856904617574e-300 or 7.094564478841642e-150 < a

    1. Initial program 23.4

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

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

    if 7.138856904617574e-300 < a < 7.094564478841642e-150

    1. Initial program 29.5

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Taylor expanded around inf 13.7

      \[\leadsto \color{blue}{\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification10.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le 7.138856904617573736839661174627961894213 \cdot 10^{-300}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 7.094564478841642016435598054575819343262 \cdot 10^{-150}:\\ \;\;\;\;\left(y + \frac{z \cdot x}{t}\right) - \frac{y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \end{array}\]

Reproduce

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

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

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