Average Error: 24.4 → 10.9
Time: 55.1s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -3.534021344710367316034284812808367674594 \cdot 10^{-239}:\\ \;\;\;\;\left(\frac{z}{a - t} - \frac{t}{a - t}\right) \cdot \left(y - x\right) + x\\ \mathbf{elif}\;a \le 1.848795705323621451248203240291853485952 \cdot 10^{-271}:\\ \;\;\;\;\left(\frac{z \cdot x}{t} + y\right) - \frac{z \cdot y}{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 -3.534021344710367316034284812808367674594 \cdot 10^{-239}:\\
\;\;\;\;\left(\frac{z}{a - t} - \frac{t}{a - t}\right) \cdot \left(y - x\right) + x\\

\mathbf{elif}\;a \le 1.848795705323621451248203240291853485952 \cdot 10^{-271}:\\
\;\;\;\;\left(\frac{z \cdot x}{t} + y\right) - \frac{z \cdot y}{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 r29987580 = x;
        double r29987581 = y;
        double r29987582 = r29987581 - r29987580;
        double r29987583 = z;
        double r29987584 = t;
        double r29987585 = r29987583 - r29987584;
        double r29987586 = r29987582 * r29987585;
        double r29987587 = a;
        double r29987588 = r29987587 - r29987584;
        double r29987589 = r29987586 / r29987588;
        double r29987590 = r29987580 + r29987589;
        return r29987590;
}

double f(double x, double y, double z, double t, double a) {
        double r29987591 = a;
        double r29987592 = -3.5340213447103673e-239;
        bool r29987593 = r29987591 <= r29987592;
        double r29987594 = z;
        double r29987595 = t;
        double r29987596 = r29987591 - r29987595;
        double r29987597 = r29987594 / r29987596;
        double r29987598 = r29987595 / r29987596;
        double r29987599 = r29987597 - r29987598;
        double r29987600 = y;
        double r29987601 = x;
        double r29987602 = r29987600 - r29987601;
        double r29987603 = r29987599 * r29987602;
        double r29987604 = r29987603 + r29987601;
        double r29987605 = 1.8487957053236215e-271;
        bool r29987606 = r29987591 <= r29987605;
        double r29987607 = r29987594 * r29987601;
        double r29987608 = r29987607 / r29987595;
        double r29987609 = r29987608 + r29987600;
        double r29987610 = r29987594 * r29987600;
        double r29987611 = r29987610 / r29987595;
        double r29987612 = r29987609 - r29987611;
        double r29987613 = r29987594 - r29987595;
        double r29987614 = r29987596 / r29987613;
        double r29987615 = r29987602 / r29987614;
        double r29987616 = r29987601 + r29987615;
        double r29987617 = r29987606 ? r29987612 : r29987616;
        double r29987618 = r29987593 ? r29987604 : r29987617;
        return r29987618;
}

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.3
Herbie10.9
\[\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 3 regimes
  2. if a < -3.5340213447103673e-239

    1. Initial program 24.1

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{a - t}{z - t}}}\]
    4. Using strategy rm
    5. Applied div-inv10.8

      \[\leadsto x + \color{blue}{\left(y - x\right) \cdot \frac{1}{\frac{a - t}{z - t}}}\]
    6. Simplified10.8

      \[\leadsto x + \left(y - x\right) \cdot \color{blue}{\frac{z - t}{a - t}}\]
    7. Using strategy rm
    8. Applied div-sub10.8

      \[\leadsto x + \left(y - x\right) \cdot \color{blue}{\left(\frac{z}{a - t} - \frac{t}{a - t}\right)}\]

    if -3.5340213447103673e-239 < a < 1.8487957053236215e-271

    1. Initial program 31.1

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

      \[\leadsto \color{blue}{\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}}\]

    if 1.8487957053236215e-271 < a

    1. Initial program 23.6

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{a - t}{z - t}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.9

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

Reproduce

herbie shell --seed 2019200 
(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))))