Average Error: 23.9 → 10.4
Time: 24.0s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.4427683470607565 \cdot 10^{-114}:\\ \;\;\;\;\frac{1}{\frac{\frac{a}{z - t} - \frac{t}{z - t}}{y - x}} + x\\ \mathbf{elif}\;a \le 1.0989115963069107 \cdot 10^{-135}:\\ \;\;\;\;\left(\frac{x \cdot z}{t} + y\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{a}{z - t} - \frac{t}{z - t}}{y - x}} + x\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -1.4427683470607565 \cdot 10^{-114}:\\
\;\;\;\;\frac{1}{\frac{\frac{a}{z - t} - \frac{t}{z - t}}{y - x}} + x\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r28276034 = x;
        double r28276035 = y;
        double r28276036 = r28276035 - r28276034;
        double r28276037 = z;
        double r28276038 = t;
        double r28276039 = r28276037 - r28276038;
        double r28276040 = r28276036 * r28276039;
        double r28276041 = a;
        double r28276042 = r28276041 - r28276038;
        double r28276043 = r28276040 / r28276042;
        double r28276044 = r28276034 + r28276043;
        return r28276044;
}

double f(double x, double y, double z, double t, double a) {
        double r28276045 = a;
        double r28276046 = -1.4427683470607565e-114;
        bool r28276047 = r28276045 <= r28276046;
        double r28276048 = 1.0;
        double r28276049 = z;
        double r28276050 = t;
        double r28276051 = r28276049 - r28276050;
        double r28276052 = r28276045 / r28276051;
        double r28276053 = r28276050 / r28276051;
        double r28276054 = r28276052 - r28276053;
        double r28276055 = y;
        double r28276056 = x;
        double r28276057 = r28276055 - r28276056;
        double r28276058 = r28276054 / r28276057;
        double r28276059 = r28276048 / r28276058;
        double r28276060 = r28276059 + r28276056;
        double r28276061 = 1.0989115963069107e-135;
        bool r28276062 = r28276045 <= r28276061;
        double r28276063 = r28276056 * r28276049;
        double r28276064 = r28276063 / r28276050;
        double r28276065 = r28276064 + r28276055;
        double r28276066 = r28276049 * r28276055;
        double r28276067 = r28276066 / r28276050;
        double r28276068 = r28276065 - r28276067;
        double r28276069 = r28276062 ? r28276068 : r28276060;
        double r28276070 = r28276047 ? r28276060 : r28276069;
        return r28276070;
}

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

Original23.9
Target9.1
Herbie10.4
\[\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.774403170083174 \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 2 regimes
  2. if a < -1.4427683470607565e-114 or 1.0989115963069107e-135 < 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 associate-/l*8.5

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

      \[\leadsto x + \color{blue}{\frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}}\]
    6. Using strategy rm
    7. Applied div-sub8.6

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

    if -1.4427683470607565e-114 < a < 1.0989115963069107e-135

    1. Initial program 29.8

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

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

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

Reproduce

herbie shell --seed 2019165 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"

  :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))))