Average Error: 24.2 → 10.4
Time: 14.9s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -4.2852583466209365 \cdot 10^{-144}:\\ \;\;\;\;x + \left(y - x\right) \cdot \left(\left(z - t\right) \cdot \frac{1}{a - t}\right)\\ \mathbf{elif}\;a \le 2.0695378041879823 \cdot 10^{-147}:\\ \;\;\;\;\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 -4.2852583466209365 \cdot 10^{-144}:\\
\;\;\;\;x + \left(y - x\right) \cdot \left(\left(z - t\right) \cdot \frac{1}{a - t}\right)\\

\mathbf{elif}\;a \le 2.0695378041879823 \cdot 10^{-147}:\\
\;\;\;\;\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 r666552 = x;
        double r666553 = y;
        double r666554 = r666553 - r666552;
        double r666555 = z;
        double r666556 = t;
        double r666557 = r666555 - r666556;
        double r666558 = r666554 * r666557;
        double r666559 = a;
        double r666560 = r666559 - r666556;
        double r666561 = r666558 / r666560;
        double r666562 = r666552 + r666561;
        return r666562;
}

double f(double x, double y, double z, double t, double a) {
        double r666563 = a;
        double r666564 = -4.2852583466209365e-144;
        bool r666565 = r666563 <= r666564;
        double r666566 = x;
        double r666567 = y;
        double r666568 = r666567 - r666566;
        double r666569 = z;
        double r666570 = t;
        double r666571 = r666569 - r666570;
        double r666572 = 1.0;
        double r666573 = r666563 - r666570;
        double r666574 = r666572 / r666573;
        double r666575 = r666571 * r666574;
        double r666576 = r666568 * r666575;
        double r666577 = r666566 + r666576;
        double r666578 = 2.0695378041879823e-147;
        bool r666579 = r666563 <= r666578;
        double r666580 = r666566 * r666569;
        double r666581 = r666580 / r666570;
        double r666582 = r666567 + r666581;
        double r666583 = r666569 * r666567;
        double r666584 = r666583 / r666570;
        double r666585 = r666582 - r666584;
        double r666586 = r666573 / r666571;
        double r666587 = r666568 / r666586;
        double r666588 = r666566 + r666587;
        double r666589 = r666579 ? r666585 : r666588;
        double r666590 = r666565 ? r666577 : r666589;
        return r666590;
}

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.2
Target9.3
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.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 < -4.2852583466209365e-144

    1. Initial program 23.0

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

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

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

      \[\leadsto x + \color{blue}{\left(y - x\right)} \cdot \frac{z - t}{a - t}\]
    6. Using strategy rm
    7. Applied div-inv9.3

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

    if -4.2852583466209365e-144 < a < 2.0695378041879823e-147

    1. Initial program 30.0

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

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

    if 2.0695378041879823e-147 < a

    1. Initial program 21.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -4.2852583466209365 \cdot 10^{-144}:\\ \;\;\;\;x + \left(y - x\right) \cdot \left(\left(z - t\right) \cdot \frac{1}{a - t}\right)\\ \mathbf{elif}\;a \le 2.0695378041879823 \cdot 10^{-147}:\\ \;\;\;\;\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 2020045 
(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))))