Average Error: 14.4 → 9.3
Time: 5.8s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.28480809319162867 \cdot 10^{173} \lor \neg \left(z \le 1.41772240633504955 \cdot 10^{216}\right):\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y - z}{a - z}}{\frac{1}{t - x}} + x\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -2.28480809319162867 \cdot 10^{173} \lor \neg \left(z \le 1.41772240633504955 \cdot 10^{216}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\

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

\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 <= -2.2848080931916287e+173) || !(z <= 1.4177224063350496e+216))) {
		VAR = fma(y, ((x / z) - (t / z)), t);
	} else {
		VAR = ((((y - z) / (a - z)) / (1.0 / (t - x))) + x);
	}
	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 2 regimes
  2. if z < -2.2848080931916287e+173 or 1.4177224063350496e+216 < z

    1. Initial program 28.0

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

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

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

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

    if -2.2848080931916287e+173 < z < 1.4177224063350496e+216

    1. Initial program 10.8

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

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

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

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x\]
    8. Using strategy rm
    9. Applied div-inv10.7

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

      \[\leadsto \color{blue}{\frac{\frac{y - z}{a - z}}{\frac{1}{t - x}}} + x\]
  3. Recombined 2 regimes into one program.
  4. Final simplification9.3

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

Reproduce

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