Average Error: 15.0 → 12.0
Time: 5.3s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.05897695730342099 \cdot 10^{-175}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \left(t - x\right) \cdot \frac{1}{a - z}, x\right)\\ \mathbf{elif}\;a \le 4.92493862195949841 \cdot 10^{-109}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{elif}\;a \le 6.4005794446964177 \cdot 10^{-76}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{elif}\;a \le 5.8876355109306171 \cdot 10^{-63}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -1.05897695730342099 \cdot 10^{-175}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \left(t - x\right) \cdot \frac{1}{a - z}, x\right)\\

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

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\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 ((a <= -1.058976957303421e-175)) {
		VAR = fma((y - z), ((t - x) * (1.0 / (a - z))), x);
	} else {
		double VAR_1;
		if ((a <= 4.924938621959498e-109)) {
			VAR_1 = fma(y, ((x / z) - (t / z)), t);
		} else {
			double VAR_2;
			if ((a <= 6.400579444696418e-76)) {
				VAR_2 = (x + (((y - z) * (t - x)) / (a - z)));
			} else {
				double VAR_3;
				if ((a <= 5.887635510930617e-63)) {
					VAR_3 = fma(y, ((x / z) - (t / z)), t);
				} else {
					VAR_3 = fma((y - z), ((t - x) / (a - z)), x);
				}
				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

Derivation

  1. Split input into 4 regimes
  2. if a < -1.058976957303421e-175

    1. Initial program 12.6

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

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

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

    if -1.058976957303421e-175 < a < 4.924938621959498e-109 or 6.400579444696418e-76 < a < 5.887635510930617e-63

    1. Initial program 24.9

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

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

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

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

    if 4.924938621959498e-109 < a < 6.400579444696418e-76

    1. Initial program 22.9

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

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

    if 5.887635510930617e-63 < a

    1. Initial program 9.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.05897695730342099 \cdot 10^{-175}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \left(t - x\right) \cdot \frac{1}{a - z}, x\right)\\ \mathbf{elif}\;a \le 4.92493862195949841 \cdot 10^{-109}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{elif}\;a \le 6.4005794446964177 \cdot 10^{-76}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{elif}\;a \le 5.8876355109306171 \cdot 10^{-63}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020091 +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)))))