Average Error: 24.7 → 10.7
Time: 17.5min
Precision: binary64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.13818177103117769 \cdot 10^{136}:\\ \;\;\;\;\frac{y}{z} \cdot \left(x - t\right) + t\\ \mathbf{else}:\\ \;\;\;\;x + \frac{t - x}{\frac{a - z}{y - z}}\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -2.13818177103117769 \cdot 10^{136}:\\
\;\;\;\;\frac{y}{z} \cdot \left(x - t\right) + t\\

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

\end{array}
double code(double x, double y, double z, double t, double a) {
	return ((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z)))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if ((z <= -2.1381817710311777e+136)) {
		VAR = ((double) (((double) ((y / z) * ((double) (x - t)))) + t));
	} else {
		VAR = ((double) (x + (((double) (t - x)) / (((double) (a - z)) / ((double) (y - z))))));
	}
	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.7
Target11.9
Herbie10.7
\[\begin{array}{l} \mathbf{if}\;z \lt -1.25361310560950359 \cdot 10^{188}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{elif}\;z \lt 4.44670236911381103 \cdot 10^{64}:\\ \;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\ \mathbf{else}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -2.13818177103117769e136

    1. Initial program 47.5

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

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

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

    if -2.13818177103117769e136 < z

    1. Initial program 20.6

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt21.1

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

      \[\leadsto x + \color{blue}{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{a - z}}}\]
    5. Using strategy rm
    6. Applied pow110.7

      \[\leadsto x + \frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \color{blue}{{\left(\frac{t - x}{\sqrt[3]{a - z}}\right)}^{1}}\]
    7. Applied pow110.7

      \[\leadsto x + \color{blue}{{\left(\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right)}^{1}} \cdot {\left(\frac{t - x}{\sqrt[3]{a - z}}\right)}^{1}\]
    8. Applied pow-prod-down10.7

      \[\leadsto x + \color{blue}{{\left(\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{a - z}}\right)}^{1}}\]
    9. Simplified9.8

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

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

Reproduce

herbie shell --seed 2020181 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< z -1.2536131056095036e+188) (- t (* (/ y z) (- t x))) (if (< z 4.446702369113811e+64) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x)))))

  (+ x (/ (* (- y z) (- t x)) (- a z))))