Average Error: 14.9 → 12.5
Time: 6.6s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.52100105036061421 \cdot 10^{-168}:\\ \;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\right)\\ \mathbf{elif}\;a \le 3.6850404799821675 \cdot 10^{-175}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\ \mathbf{elif}\;a \le 4.82832697489963789 \cdot 10^{36}:\\ \;\;\;\;x + \frac{\left(t - x\right) \cdot \left(y - z\right)}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -1.52100105036061421 \cdot 10^{-168}:\\
\;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\right)\\

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

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

\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\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 temp;
	if ((a <= -1.5210010503606142e-168)) {
		temp = (x + ((y - z) * ((t - x) * (1.0 / (a - z)))));
	} else {
		double temp_1;
		if ((a <= 3.6850404799821675e-175)) {
			temp_1 = fma((x / z), y, (t - ((t * y) / z)));
		} else {
			double temp_2;
			if ((a <= 4.828326974899638e+36)) {
				temp_2 = (x + (((t - x) * (y - z)) / (a - z)));
			} else {
				temp_2 = (x + ((y - z) * ((t - x) * (1.0 / (a - z)))));
			}
			temp_1 = temp_2;
		}
		temp = temp_1;
	}
	return temp;
}

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

Derivation

  1. Split input into 3 regimes
  2. if a < -1.5210010503606142e-168 or 4.828326974899638e+36 < a

    1. Initial program 10.1

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

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

    if -1.5210010503606142e-168 < a < 3.6850404799821675e-175

    1. Initial program 27.1

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

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

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

    if 3.6850404799821675e-175 < a < 4.828326974899638e+36

    1. Initial program 19.1

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

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\left(\left(t - x\right) \cdot \frac{1}{a - z}\right)}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt19.6

      \[\leadsto x + \color{blue}{\left(\left(\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}\right) \cdot \sqrt[3]{y - z}\right)} \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\right)\]
    6. Applied associate-*l*19.7

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

      \[\leadsto x + \left(\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}\right) \cdot \color{blue}{\left(\frac{t - x}{a - z} \cdot \sqrt[3]{y - z}\right)}\]
    8. Using strategy rm
    9. Applied associate-*l/19.8

      \[\leadsto x + \left(\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}\right) \cdot \color{blue}{\frac{\left(t - x\right) \cdot \sqrt[3]{y - z}}{a - z}}\]
    10. Applied associate-*r/23.2

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

      \[\leadsto x + \frac{\color{blue}{\left(t - x\right) \cdot \left(y - z\right)}}{a - z}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification12.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.52100105036061421 \cdot 10^{-168}:\\ \;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\right)\\ \mathbf{elif}\;a \le 3.6850404799821675 \cdot 10^{-175}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\ \mathbf{elif}\;a \le 4.82832697489963789 \cdot 10^{36}:\\ \;\;\;\;x + \frac{\left(t - x\right) \cdot \left(y - z\right)}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020066 +o rules:numerics
(FPCore (x y z t a)
  :name "Numeric.Signal:interpolate   from hsignal-0.2.7.1"
  :precision binary64
  (+ x (* (- y z) (/ (- t x) (- a z)))))