Average Error: 24.3 → 10.9
Time: 31.8s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.264122689569453656842879868519212174824 \cdot 10^{-228}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 1.474978086208166197165144421451213606011 \cdot 10^{-72}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -1.264122689569453656842879868519212174824 \cdot 10^{-228}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\

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

\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r439694 = x;
        double r439695 = y;
        double r439696 = r439695 - r439694;
        double r439697 = z;
        double r439698 = t;
        double r439699 = r439697 - r439698;
        double r439700 = r439696 * r439699;
        double r439701 = a;
        double r439702 = r439701 - r439698;
        double r439703 = r439700 / r439702;
        double r439704 = r439694 + r439703;
        return r439704;
}

double f(double x, double y, double z, double t, double a) {
        double r439705 = a;
        double r439706 = -1.2641226895694537e-228;
        bool r439707 = r439705 <= r439706;
        double r439708 = x;
        double r439709 = y;
        double r439710 = r439709 - r439708;
        double r439711 = t;
        double r439712 = r439705 - r439711;
        double r439713 = z;
        double r439714 = r439713 - r439711;
        double r439715 = r439712 / r439714;
        double r439716 = r439710 / r439715;
        double r439717 = r439708 + r439716;
        double r439718 = 1.4749780862081662e-72;
        bool r439719 = r439705 <= r439718;
        double r439720 = r439708 * r439713;
        double r439721 = r439720 / r439711;
        double r439722 = r439709 + r439721;
        double r439723 = r439713 * r439709;
        double r439724 = r439723 / r439711;
        double r439725 = r439722 - r439724;
        double r439726 = r439714 / r439712;
        double r439727 = r439710 * r439726;
        double r439728 = r439708 + r439727;
        double r439729 = r439719 ? r439725 : r439728;
        double r439730 = r439707 ? r439717 : r439729;
        return r439730;
}

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.3
Target9.5
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 < -1.2641226895694537e-228

    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.8

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

    if -1.2641226895694537e-228 < a < 1.4749780862081662e-72

    1. Initial program 29.5

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

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

    if 1.4749780862081662e-72 < a

    1. Initial program 21.9

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity21.9

      \[\leadsto x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{\color{blue}{1 \cdot \left(a - t\right)}}\]
    4. Applied times-frac7.9

      \[\leadsto x + \color{blue}{\frac{y - x}{1} \cdot \frac{z - t}{a - t}}\]
    5. Simplified7.9

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

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

Reproduce

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