Average Error: 24.6 → 11.8
Time: 4.1s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.4065350202544076 \cdot 10^{-8}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{1}{z - t}}{\frac{y - x}{a - t}}}\\ \mathbf{elif}\;a \le -4.81957115971569602 \cdot 10^{-58}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{elif}\;a \le -3.42609957675525156 \cdot 10^{-167}:\\ \;\;\;\;x + \frac{\frac{y - x}{a - t}}{\frac{1}{z - t}}\\ \mathbf{elif}\;a \le 2.50213665982368351 \cdot 10^{-191}:\\ \;\;\;\;\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 -1.4065350202544076 \cdot 10^{-8}:\\
\;\;\;\;x + \frac{1}{\frac{\frac{1}{z - t}}{\frac{y - x}{a - t}}}\\

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

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

\mathbf{elif}\;a \le 2.50213665982368351 \cdot 10^{-191}:\\
\;\;\;\;\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 code(double x, double y, double z, double t, double a) {
	return (x + (((y - x) * (z - t)) / (a - t)));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if ((a <= -1.4065350202544076e-08)) {
		VAR = (x + (1.0 / ((1.0 / (z - t)) / ((y - x) / (a - t)))));
	} else {
		double VAR_1;
		if ((a <= -4.819571159715696e-58)) {
			VAR_1 = ((y + ((x * z) / t)) - ((z * y) / t));
		} else {
			double VAR_2;
			if ((a <= -3.4260995767552516e-167)) {
				VAR_2 = (x + (((y - x) / (a - t)) / (1.0 / (z - t))));
			} else {
				double VAR_3;
				if ((a <= 2.5021366598236835e-191)) {
					VAR_3 = ((y + ((x * z) / t)) - ((z * y) / t));
				} else {
					VAR_3 = (x + ((y - x) / ((a / (z - t)) - (t / (z - t)))));
				}
				VAR_2 = VAR_3;
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.6
Target9.3
Herbie11.8
\[\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 4 regimes
  2. if a < -1.4065350202544076e-08

    1. Initial program 23.0

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

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

      \[\leadsto x + \frac{y - x}{\color{blue}{\frac{a}{z - t} - \frac{t}{z - t}}}\]
    6. Using strategy rm
    7. Applied clear-num7.2

      \[\leadsto x + \color{blue}{\frac{1}{\frac{\frac{a}{z - t} - \frac{t}{z - t}}{y - x}}}\]
    8. Using strategy rm
    9. Applied div-inv7.2

      \[\leadsto x + \frac{1}{\frac{\frac{a}{z - t} - \color{blue}{t \cdot \frac{1}{z - t}}}{y - x}}\]
    10. Applied div-inv7.2

      \[\leadsto x + \frac{1}{\frac{\color{blue}{a \cdot \frac{1}{z - t}} - t \cdot \frac{1}{z - t}}{y - x}}\]
    11. Applied distribute-rgt-out--7.2

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

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

    if -1.4065350202544076e-08 < a < -4.819571159715696e-58 or -3.4260995767552516e-167 < a < 2.5021366598236835e-191

    1. Initial program 28.4

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

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

    if -4.819571159715696e-58 < a < -3.4260995767552516e-167

    1. Initial program 26.6

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

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

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

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

    if 2.5021366598236835e-191 < a

    1. Initial program 23.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.4065350202544076 \cdot 10^{-8}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{1}{z - t}}{\frac{y - x}{a - t}}}\\ \mathbf{elif}\;a \le -4.81957115971569602 \cdot 10^{-58}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{elif}\;a \le -3.42609957675525156 \cdot 10^{-167}:\\ \;\;\;\;x + \frac{\frac{y - x}{a - t}}{\frac{1}{z - t}}\\ \mathbf{elif}\;a \le 2.50213665982368351 \cdot 10^{-191}:\\ \;\;\;\;\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 2020078 
(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))))