Average Error: 14.8 → 10.3
Time: 4.5s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.9570555974264209 \cdot 10^{-246} \lor \neg \left(a \le 1.27973404493183034 \cdot 10^{-148}\right):\\ \;\;\;\;x + \frac{y - z}{-\left(a - z\right)} \cdot \left(-\left(t - x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -2.9570555974264209 \cdot 10^{-246} \lor \neg \left(a \le 1.27973404493183034 \cdot 10^{-148}\right):\\
\;\;\;\;x + \frac{y - z}{-\left(a - z\right)} \cdot \left(-\left(t - x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\

\end{array}
double code(double x, double y, double z, double t, double a) {
	return ((double) (x + ((double) (((double) (y - z)) * ((double) (((double) (t - x)) / ((double) (a - z))))))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if (((a <= -2.957055597426421e-246) || !(a <= 1.2797340449318303e-148))) {
		VAR = ((double) (x + ((double) (((double) (((double) (y - z)) / ((double) -(((double) (a - z)))))) * ((double) -(((double) (t - x))))))));
	} else {
		VAR = ((double) fma(y, ((double) (((double) (x / z)) - ((double) (t / z)))), 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 < -2.957055597426421e-246 or 1.2797340449318303e-148 < a

    1. Initial program 13.1

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

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{1}{\frac{a - z}{t - x}}}\]
    4. Applied un-div-inv13.1

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}}\]
    5. Using strategy rm
    6. Applied frac-2neg13.1

      \[\leadsto x + \frac{y - z}{\color{blue}{\frac{-\left(a - z\right)}{-\left(t - x\right)}}}\]
    7. Applied associate-/r/10.3

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

    if -2.957055597426421e-246 < a < 1.2797340449318303e-148

    1. Initial program 24.6

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

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

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

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

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

Reproduce

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