Average Error: 14.6 → 9.3
Time: 3.7s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -6.70601397749614666 \cdot 10^{-149} \lor \neg \left(a \le 2.1567847010867933 \cdot 10^{-199}\right):\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x - t, t\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -6.70601397749614666 \cdot 10^{-149} \lor \neg \left(a \le 2.1567847010867933 \cdot 10^{-199}\right):\\
\;\;\;\;x + \frac{y - z}{a - z} \cdot \left(t - x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x - t, 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 (((a <= -6.706013977496147e-149) || !(a <= 2.1567847010867933e-199))) {
		VAR = (x + (((y - z) / (a - z)) * (t - x)));
	} else {
		VAR = fma((y / z), (x - t), t);
	}
	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 a < -6.706013977496147e-149 or 2.1567847010867933e-199 < a

    1. Initial program 11.9

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

      \[\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 *-commutative11.9

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

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

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

    if -6.706013977496147e-149 < a < 2.1567847010867933e-199

    1. Initial program 26.4

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

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

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

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

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

Reproduce

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