Average Error: 24.5 → 10.3
Time: 31.3s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -8.219955541919713617532314896871658930044 \cdot 10^{-141}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 2.24024890037346614578132900614031554594 \cdot 10^{-218}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\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 -8.219955541919713617532314896871658930044 \cdot 10^{-141}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\

\mathbf{elif}\;a \le 2.24024890037346614578132900614031554594 \cdot 10^{-218}:\\
\;\;\;\;\left(y + \frac{x \cdot z}{t}\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 r113163738 = x;
        double r113163739 = y;
        double r113163740 = r113163739 - r113163738;
        double r113163741 = z;
        double r113163742 = t;
        double r113163743 = r113163741 - r113163742;
        double r113163744 = r113163740 * r113163743;
        double r113163745 = a;
        double r113163746 = r113163745 - r113163742;
        double r113163747 = r113163744 / r113163746;
        double r113163748 = r113163738 + r113163747;
        return r113163748;
}

double f(double x, double y, double z, double t, double a) {
        double r113163749 = a;
        double r113163750 = -8.219955541919714e-141;
        bool r113163751 = r113163749 <= r113163750;
        double r113163752 = x;
        double r113163753 = y;
        double r113163754 = r113163753 - r113163752;
        double r113163755 = t;
        double r113163756 = r113163749 - r113163755;
        double r113163757 = z;
        double r113163758 = r113163757 - r113163755;
        double r113163759 = r113163756 / r113163758;
        double r113163760 = r113163754 / r113163759;
        double r113163761 = r113163752 + r113163760;
        double r113163762 = 2.2402489003734661e-218;
        bool r113163763 = r113163749 <= r113163762;
        double r113163764 = r113163752 * r113163757;
        double r113163765 = r113163764 / r113163755;
        double r113163766 = r113163753 + r113163765;
        double r113163767 = r113163757 * r113163753;
        double r113163768 = r113163767 / r113163755;
        double r113163769 = r113163766 - r113163768;
        double r113163770 = r113163763 ? r113163769 : r113163761;
        double r113163771 = r113163751 ? r113163761 : r113163770;
        return r113163771;
}

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.5
Target9.3
Herbie10.3
\[\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 < -8.219955541919714e-141 or 2.2402489003734661e-218 < a

    1. Initial program 23.3

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

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

    if -8.219955541919714e-141 < a < 2.2402489003734661e-218

    1. Initial program 30.2

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

      \[\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.3

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

Reproduce

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