Average Error: 25.0 → 10.3
Time: 8.1s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.344676009041024767063435413969372278651 \cdot 10^{-176}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 4.650934300689651493049628385431993780051 \cdot 10^{-155}:\\ \;\;\;\;\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.344676009041024767063435413969372278651 \cdot 10^{-176}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\

\mathbf{elif}\;a \le 4.650934300689651493049628385431993780051 \cdot 10^{-155}:\\
\;\;\;\;\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 r866828 = x;
        double r866829 = y;
        double r866830 = r866829 - r866828;
        double r866831 = z;
        double r866832 = t;
        double r866833 = r866831 - r866832;
        double r866834 = r866830 * r866833;
        double r866835 = a;
        double r866836 = r866835 - r866832;
        double r866837 = r866834 / r866836;
        double r866838 = r866828 + r866837;
        return r866838;
}

double f(double x, double y, double z, double t, double a) {
        double r866839 = a;
        double r866840 = -1.3446760090410248e-176;
        bool r866841 = r866839 <= r866840;
        double r866842 = x;
        double r866843 = y;
        double r866844 = r866843 - r866842;
        double r866845 = t;
        double r866846 = r866839 - r866845;
        double r866847 = z;
        double r866848 = r866847 - r866845;
        double r866849 = r866846 / r866848;
        double r866850 = r866844 / r866849;
        double r866851 = r866842 + r866850;
        double r866852 = 4.6509343006896515e-155;
        bool r866853 = r866839 <= r866852;
        double r866854 = r866842 * r866847;
        double r866855 = r866854 / r866845;
        double r866856 = r866843 + r866855;
        double r866857 = r866847 * r866843;
        double r866858 = r866857 / r866845;
        double r866859 = r866856 - r866858;
        double r866860 = r866848 / r866846;
        double r866861 = r866844 * r866860;
        double r866862 = r866842 + r866861;
        double r866863 = r866853 ? r866859 : r866862;
        double r866864 = r866841 ? r866851 : r866863;
        return r866864;
}

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

Original25.0
Target9.6
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 3 regimes
  2. if a < -1.3446760090410248e-176

    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*9.2

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

    if -1.3446760090410248e-176 < a < 4.6509343006896515e-155

    1. Initial program 29.8

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

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

    if 4.6509343006896515e-155 < a

    1. Initial program 24.1

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.344676009041024767063435413969372278651 \cdot 10^{-176}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 4.650934300689651493049628385431993780051 \cdot 10^{-155}:\\ \;\;\;\;\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 2019353 
(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))))