Average Error: 24.3 → 10.3
Time: 8.5s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -6.06420332548427723 \cdot 10^{171}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{elif}\;z \le -1.70088398145157717 \cdot 10^{84}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y - z, x\right)\\ \mathbf{elif}\;z \le -4.4075266371189889 \cdot 10^{48}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{elif}\;z \le 2.1885508948319571 \cdot 10^{182}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\frac{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}{1}}, \frac{\sqrt[3]{t - x}}{\frac{\sqrt[3]{a - z}}{y - z}}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -6.06420332548427723 \cdot 10^{171}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\

\mathbf{elif}\;z \le -1.70088398145157717 \cdot 10^{84}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y - z, x\right)\\

\mathbf{elif}\;z \le -4.4075266371189889 \cdot 10^{48}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\

\mathbf{elif}\;z \le 2.1885508948319571 \cdot 10^{182}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\frac{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}{1}}, \frac{\sqrt[3]{t - x}}{\frac{\sqrt[3]{a - z}}{y - z}}, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\

\end{array}
double code(double x, double y, double z, double t, double a) {
	return (x + (((y - z) * (t - x)) / (a - z)));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if ((z <= -6.064203325484277e+171)) {
		VAR = fma(y, ((x / z) - (t / z)), t);
	} else {
		double VAR_1;
		if ((z <= -1.7008839814515772e+84)) {
			VAR_1 = fma(((t - x) / (a - z)), (y - z), x);
		} else {
			double VAR_2;
			if ((z <= -4.407526637118989e+48)) {
				VAR_2 = fma(y, ((x / z) - (t / z)), t);
			} else {
				double VAR_3;
				if ((z <= 2.188550894831957e+182)) {
					VAR_3 = fma(((cbrt((t - x)) * cbrt((t - x))) / ((cbrt((a - z)) * cbrt((a - z))) / 1.0)), (cbrt((t - x)) / (cbrt((a - z)) / (y - z))), x);
				} else {
					VAR_3 = fma(y, ((x / z) - (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.3
Target11.9
Herbie10.3
\[\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 3 regimes
  2. if z < -6.064203325484277e+171 or -1.7008839814515772e+84 < z < -4.407526637118989e+48 or 2.188550894831957e+182 < z

    1. Initial program 46.0

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Simplified21.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)}\]
    3. Taylor expanded around inf 23.9

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)}\]

    if -6.064203325484277e+171 < z < -1.7008839814515772e+84

    1. Initial program 34.0

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Simplified16.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)}\]
    3. Using strategy rm
    4. Applied clear-num16.1

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{\frac{a - z}{y - z}}}, t - x, x\right)\]
    5. Using strategy rm
    6. Applied fma-udef16.2

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

      \[\leadsto \color{blue}{\frac{t - x}{\frac{a - z}{y - z}}} + x\]
    8. Using strategy rm
    9. Applied associate-/r/17.4

      \[\leadsto \color{blue}{\frac{t - x}{a - z} \cdot \left(y - z\right)} + x\]
    10. Applied fma-def17.3

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t - x}{a - z}, y - z, x\right)}\]

    if -4.407526637118989e+48 < z < 2.188550894831957e+182

    1. Initial program 13.8

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Simplified7.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)}\]
    3. Using strategy rm
    4. Applied clear-num7.3

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{\frac{a - z}{y - z}}}, t - x, x\right)\]
    5. Using strategy rm
    6. Applied fma-udef7.3

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

      \[\leadsto \color{blue}{\frac{t - x}{\frac{a - z}{y - z}}} + x\]
    8. Using strategy rm
    9. Applied *-un-lft-identity7.2

      \[\leadsto \frac{t - x}{\frac{a - z}{\color{blue}{1 \cdot \left(y - z\right)}}} + x\]
    10. Applied add-cube-cbrt7.8

      \[\leadsto \frac{t - x}{\frac{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}}{1 \cdot \left(y - z\right)}} + x\]
    11. Applied times-frac7.8

      \[\leadsto \frac{t - x}{\color{blue}{\frac{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}{1} \cdot \frac{\sqrt[3]{a - z}}{y - z}}} + x\]
    12. Applied add-cube-cbrt7.9

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\frac{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}{1}} \cdot \frac{\sqrt[3]{t - x}}{\frac{\sqrt[3]{a - z}}{y - z}}} + x\]
    14. Applied fma-def7.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\frac{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}{1}}, \frac{\sqrt[3]{t - x}}{\frac{\sqrt[3]{a - z}}{y - z}}, x\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -6.06420332548427723 \cdot 10^{171}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{elif}\;z \le -1.70088398145157717 \cdot 10^{84}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y - z, x\right)\\ \mathbf{elif}\;z \le -4.4075266371189889 \cdot 10^{48}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{elif}\;z \le 2.1885508948319571 \cdot 10^{182}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\frac{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}{1}}, \frac{\sqrt[3]{t - x}}{\frac{\sqrt[3]{a - z}}{y - z}}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020079 +o rules:numerics
(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))))