Average Error: 24.1 → 10.7
Time: 5.3s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.8452776584917417 \cdot 10^{-147}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 5.64778422898679971 \cdot 10^{-273}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{elif}\;a \le 2.43526858019407374 \cdot 10^{-178}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}\\ \mathbf{elif}\;a \le 5.69656257028532459 \cdot 10^{-97}:\\ \;\;\;\;\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 -2.8452776584917417 \cdot 10^{-147}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\

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

\mathbf{elif}\;a \le 2.43526858019407374 \cdot 10^{-178}:\\
\;\;\;\;x + \frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}\\

\mathbf{elif}\;a \le 5.69656257028532459 \cdot 10^{-97}:\\
\;\;\;\;\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 r571032 = x;
        double r571033 = y;
        double r571034 = r571033 - r571032;
        double r571035 = z;
        double r571036 = t;
        double r571037 = r571035 - r571036;
        double r571038 = r571034 * r571037;
        double r571039 = a;
        double r571040 = r571039 - r571036;
        double r571041 = r571038 / r571040;
        double r571042 = r571032 + r571041;
        return r571042;
}

double f(double x, double y, double z, double t, double a) {
        double r571043 = a;
        double r571044 = -2.8452776584917417e-147;
        bool r571045 = r571043 <= r571044;
        double r571046 = x;
        double r571047 = y;
        double r571048 = r571047 - r571046;
        double r571049 = t;
        double r571050 = r571043 - r571049;
        double r571051 = z;
        double r571052 = r571051 - r571049;
        double r571053 = r571050 / r571052;
        double r571054 = r571048 / r571053;
        double r571055 = r571046 + r571054;
        double r571056 = 5.6477842289868e-273;
        bool r571057 = r571043 <= r571056;
        double r571058 = r571046 * r571051;
        double r571059 = r571058 / r571049;
        double r571060 = r571047 + r571059;
        double r571061 = r571051 * r571047;
        double r571062 = r571061 / r571049;
        double r571063 = r571060 - r571062;
        double r571064 = 2.4352685801940737e-178;
        bool r571065 = r571043 <= r571064;
        double r571066 = 1.0;
        double r571067 = r571053 / r571048;
        double r571068 = r571066 / r571067;
        double r571069 = r571046 + r571068;
        double r571070 = 5.696562570285325e-97;
        bool r571071 = r571043 <= r571070;
        double r571072 = r571071 ? r571063 : r571055;
        double r571073 = r571065 ? r571069 : r571072;
        double r571074 = r571057 ? r571063 : r571073;
        double r571075 = r571045 ? r571055 : r571074;
        return r571075;
}

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.3
Herbie10.7
\[\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 < -2.8452776584917417e-147 or 5.696562570285325e-97 < a

    1. Initial program 22.3

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

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

    if -2.8452776584917417e-147 < a < 5.6477842289868e-273 or 2.4352685801940737e-178 < a < 5.696562570285325e-97

    1. Initial program 28.3

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

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

    if 5.6477842289868e-273 < a < 2.4352685801940737e-178

    1. Initial program 30.6

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{a - t}{z - t}}}\]
    4. Using strategy rm
    5. Applied clear-num18.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.8452776584917417 \cdot 10^{-147}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 5.64778422898679971 \cdot 10^{-273}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{elif}\;a \le 2.43526858019407374 \cdot 10^{-178}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}\\ \mathbf{elif}\;a \le 5.69656257028532459 \cdot 10^{-97}:\\ \;\;\;\;\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 2020064 
(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))))