Average Error: 25.2 → 10.5
Time: 27.3s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -3.85925241219433013420020968270754857507 \cdot 10^{-145}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;a \le 4.817774934231587927443345859010053721242 \cdot 10^{-234}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{a}{z - t} - \frac{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 -3.85925241219433013420020968270754857507 \cdot 10^{-145}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r474637 = x;
        double r474638 = y;
        double r474639 = r474638 - r474637;
        double r474640 = z;
        double r474641 = t;
        double r474642 = r474640 - r474641;
        double r474643 = r474639 * r474642;
        double r474644 = a;
        double r474645 = r474644 - r474641;
        double r474646 = r474643 / r474645;
        double r474647 = r474637 + r474646;
        return r474647;
}

double f(double x, double y, double z, double t, double a) {
        double r474648 = a;
        double r474649 = -3.85925241219433e-145;
        bool r474650 = r474648 <= r474649;
        double r474651 = x;
        double r474652 = y;
        double r474653 = r474652 - r474651;
        double r474654 = z;
        double r474655 = t;
        double r474656 = r474654 - r474655;
        double r474657 = r474648 - r474655;
        double r474658 = r474656 / r474657;
        double r474659 = r474653 * r474658;
        double r474660 = r474651 + r474659;
        double r474661 = 4.817774934231588e-234;
        bool r474662 = r474648 <= r474661;
        double r474663 = r474651 * r474654;
        double r474664 = r474663 / r474655;
        double r474665 = r474652 + r474664;
        double r474666 = r474654 * r474652;
        double r474667 = r474666 / r474655;
        double r474668 = r474665 - r474667;
        double r474669 = r474648 / r474656;
        double r474670 = r474655 / r474656;
        double r474671 = r474669 - r474670;
        double r474672 = r474653 / r474671;
        double r474673 = r474651 + r474672;
        double r474674 = r474662 ? r474668 : r474673;
        double r474675 = r474650 ? r474660 : r474674;
        return r474675;
}

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.2
Target9.6
Herbie10.5
\[\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 < -3.85925241219433e-145

    1. Initial program 23.9

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

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

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

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

    if -3.85925241219433e-145 < a < 4.817774934231588e-234

    1. Initial program 31.1

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

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

    if 4.817774934231588e-234 < a

    1. Initial program 24.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -3.85925241219433013420020968270754857507 \cdot 10^{-145}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;a \le 4.817774934231587927443345859010053721242 \cdot 10^{-234}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{a}{z - t} - \frac{t}{z - t}}\\ \end{array}\]

Reproduce

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