Average Error: 15.0 → 12.9
Time: 4.0s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.95333646582006522 \cdot 10^{197} \lor \neg \left(z \le 2.80403393809698577 \cdot 10^{31}\right):\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{\frac{1}{a - z}}{\frac{1}{t - x}}, x\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -1.95333646582006522 \cdot 10^{197} \lor \neg \left(z \le 2.80403393809698577 \cdot 10^{31}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{\frac{1}{a - z}}{\frac{1}{t - x}}, 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 temp;
	if (((z <= -1.9533364658200652e+197) || !(z <= 2.8040339380969858e+31))) {
		temp = fma(y, ((x / z) - (t / z)), t);
	} else {
		temp = fma((y - z), ((1.0 / (a - z)) / (1.0 / (t - x))), x);
	}
	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 2 regimes
  2. if z < -1.9533364658200652e+197 or 2.8040339380969858e+31 < z

    1. Initial program 25.4

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

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

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

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

    if -1.9533364658200652e+197 < z < 2.8040339380969858e+31

    1. Initial program 9.4

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

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

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

      \[\leadsto \mathsf{fma}\left(y - z, \frac{1}{\color{blue}{\left(a - z\right) \cdot \frac{1}{t - x}}}, x\right)\]
    7. Applied associate-/r*9.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.95333646582006522 \cdot 10^{197} \lor \neg \left(z \le 2.80403393809698577 \cdot 10^{31}\right):\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{\frac{1}{a - z}}{\frac{1}{t - x}}, x\right)\\ \end{array}\]

Reproduce

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