Average Error: 24.1 → 10.5
Time: 5.6s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -3.21810197697967915 \cdot 10^{-298}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;a \le 1.7888988399164032 \cdot 10^{-210}:\\ \;\;\;\;\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 -3.21810197697967915 \cdot 10^{-298}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\

\mathbf{elif}\;a \le 1.7888988399164032 \cdot 10^{-210}:\\
\;\;\;\;\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 r586840 = x;
        double r586841 = y;
        double r586842 = r586841 - r586840;
        double r586843 = z;
        double r586844 = t;
        double r586845 = r586843 - r586844;
        double r586846 = r586842 * r586845;
        double r586847 = a;
        double r586848 = r586847 - r586844;
        double r586849 = r586846 / r586848;
        double r586850 = r586840 + r586849;
        return r586850;
}

double f(double x, double y, double z, double t, double a) {
        double r586851 = a;
        double r586852 = -3.218101976979679e-298;
        bool r586853 = r586851 <= r586852;
        double r586854 = x;
        double r586855 = y;
        double r586856 = r586855 - r586854;
        double r586857 = z;
        double r586858 = t;
        double r586859 = r586857 - r586858;
        double r586860 = r586851 - r586858;
        double r586861 = r586859 / r586860;
        double r586862 = r586856 * r586861;
        double r586863 = r586854 + r586862;
        double r586864 = 1.7888988399164032e-210;
        bool r586865 = r586851 <= r586864;
        double r586866 = r586854 * r586857;
        double r586867 = r586866 / r586858;
        double r586868 = r586855 + r586867;
        double r586869 = r586857 * r586855;
        double r586870 = r586869 / r586858;
        double r586871 = r586868 - r586870;
        double r586872 = r586860 / r586859;
        double r586873 = r586856 / r586872;
        double r586874 = r586854 + r586873;
        double r586875 = r586865 ? r586871 : r586874;
        double r586876 = r586853 ? r586863 : r586875;
        return r586876;
}

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.1
Target9.0
Herbie10.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. Split input into 3 regimes
  2. if a < -3.218101976979679e-298

    1. Initial program 24.5

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

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

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

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

    if -3.218101976979679e-298 < a < 1.7888988399164032e-210

    1. Initial program 29.3

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

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

    if 1.7888988399164032e-210 < a

    1. Initial program 22.7

      \[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}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -3.21810197697967915 \cdot 10^{-298}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;a \le 1.7888988399164032 \cdot 10^{-210}:\\ \;\;\;\;\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 2020062 
(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))))