Average Error: 24.1 → 11.2
Time: 8.7s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.1819830922564002 \cdot 10^{-66}:\\ \;\;\;\;x + \frac{\frac{y - x}{a - t}}{\frac{1}{z - t}}\\ \mathbf{elif}\;a \le 3.690197812148326 \cdot 10^{-221}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -2.1819830922564002 \cdot 10^{-66}:\\
\;\;\;\;x + \frac{\frac{y - x}{a - t}}{\frac{1}{z - t}}\\

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

\mathbf{else}:\\
\;\;\;\;x + \frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r634944 = x;
        double r634945 = y;
        double r634946 = r634945 - r634944;
        double r634947 = z;
        double r634948 = t;
        double r634949 = r634947 - r634948;
        double r634950 = r634946 * r634949;
        double r634951 = a;
        double r634952 = r634951 - r634948;
        double r634953 = r634950 / r634952;
        double r634954 = r634944 + r634953;
        return r634954;
}

double f(double x, double y, double z, double t, double a) {
        double r634955 = a;
        double r634956 = -2.1819830922564002e-66;
        bool r634957 = r634955 <= r634956;
        double r634958 = x;
        double r634959 = y;
        double r634960 = r634959 - r634958;
        double r634961 = t;
        double r634962 = r634955 - r634961;
        double r634963 = r634960 / r634962;
        double r634964 = 1.0;
        double r634965 = z;
        double r634966 = r634965 - r634961;
        double r634967 = r634964 / r634966;
        double r634968 = r634963 / r634967;
        double r634969 = r634958 + r634968;
        double r634970 = 3.690197812148326e-221;
        bool r634971 = r634955 <= r634970;
        double r634972 = r634958 * r634965;
        double r634973 = r634972 / r634961;
        double r634974 = r634959 + r634973;
        double r634975 = r634965 * r634959;
        double r634976 = r634975 / r634961;
        double r634977 = r634974 - r634976;
        double r634978 = r634962 / r634966;
        double r634979 = r634978 / r634960;
        double r634980 = r634964 / r634979;
        double r634981 = r634958 + r634980;
        double r634982 = r634971 ? r634977 : r634981;
        double r634983 = r634957 ? r634969 : r634982;
        return r634983;
}

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
Herbie11.2
\[\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.1819830922564002e-66

    1. Initial program 21.1

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{a - t}{z - t}}}\]
    4. Using strategy rm
    5. Applied div-inv7.3

      \[\leadsto x + \frac{y - x}{\color{blue}{\left(a - t\right) \cdot \frac{1}{z - t}}}\]
    6. Applied associate-/r*9.2

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

    if -2.1819830922564002e-66 < a < 3.690197812148326e-221

    1. Initial program 28.7

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

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

    if 3.690197812148326e-221 < a

    1. Initial program 23.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.1819830922564002 \cdot 10^{-66}:\\ \;\;\;\;x + \frac{\frac{y - x}{a - t}}{\frac{1}{z - t}}\\ \mathbf{elif}\;a \le 3.690197812148326 \cdot 10^{-221}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}\\ \end{array}\]

Reproduce

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