Numeric.Signal:interpolate from hsignal-0.2.7.1

Percentage Accurate: 79.4% → 90.7%
Time: 14.2s
Alternatives: 13
Speedup: 0.3×

Specification

?
\[\begin{array}{l} \\ x + \left(y - z\right) \cdot \frac{t - x}{a - z} \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
	return x + ((y - z) * ((t - x) / (a - z)));
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a):
	return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
end
function tmp = code(x, y, z, t, a)
	tmp = x + ((y - z) * ((t - x) / (a - z)));
end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 79.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(y - z\right) \cdot \frac{t - x}{a - z} \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
	return x + ((y - z) * ((t - x) / (a - z)));
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a):
	return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
end
function tmp = code(x, y, z, t, a)
	tmp = x + ((y - z) * ((t - x) / (a - z)));
end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}

Alternative 1: 90.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-249} \lor \neg \left(t\_1 \leq 5 \cdot 10^{-242}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t + \frac{t - x}{z} \cdot \left(a - y\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
   (if (or (<= t_1 -2e-249) (not (<= t_1 5e-242)))
     t_1
     (+ t (* (/ (- t x) z) (- a y))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = x + ((y - z) * ((t - x) / (a - z)));
	double tmp;
	if ((t_1 <= -2e-249) || !(t_1 <= 5e-242)) {
		tmp = t_1;
	} else {
		tmp = t + (((t - x) / z) * (a - y));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + ((y - z) * ((t - x) / (a - z)))
    if ((t_1 <= (-2d-249)) .or. (.not. (t_1 <= 5d-242))) then
        tmp = t_1
    else
        tmp = t + (((t - x) / z) * (a - y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = x + ((y - z) * ((t - x) / (a - z)));
	double tmp;
	if ((t_1 <= -2e-249) || !(t_1 <= 5e-242)) {
		tmp = t_1;
	} else {
		tmp = t + (((t - x) / z) * (a - y));
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x + ((y - z) * ((t - x) / (a - z)))
	tmp = 0
	if (t_1 <= -2e-249) or not (t_1 <= 5e-242):
		tmp = t_1
	else:
		tmp = t + (((t - x) / z) * (a - y))
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if ((t_1 <= -2e-249) || !(t_1 <= 5e-242))
		tmp = t_1;
	else
		tmp = Float64(t + Float64(Float64(Float64(t - x) / z) * Float64(a - y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + ((y - z) * ((t - x) / (a - z)));
	tmp = 0.0;
	if ((t_1 <= -2e-249) || ~((t_1 <= 5e-242)))
		tmp = t_1;
	else
		tmp = t + (((t - x) / z) * (a - y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e-249], N[Not[LessEqual[t$95$1, 5e-242]], $MachinePrecision]], t$95$1, N[(t + N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(a - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-249} \lor \neg \left(t\_1 \leq 5 \cdot 10^{-242}\right):\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t + \frac{t - x}{z} \cdot \left(a - y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000011e-249 or 4.9999999999999998e-242 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 93.1%

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

    if -2.00000000000000011e-249 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.9999999999999998e-242

    1. Initial program 3.5%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Step-by-step derivation
      1. +-commutative3.5%

        \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{t - x}{a - z} + x} \]
      2. fma-define4.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified4.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 76.0%

      \[\leadsto \color{blue}{\left(t + -1 \cdot \frac{y \cdot \left(t - x\right)}{z}\right) - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}} \]
    6. Step-by-step derivation
      1. associate--l+76.0%

        \[\leadsto \color{blue}{t + \left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}\right)} \]
      2. distribute-lft-out--76.0%

        \[\leadsto t + \color{blue}{-1 \cdot \left(\frac{y \cdot \left(t - x\right)}{z} - \frac{a \cdot \left(t - x\right)}{z}\right)} \]
      3. div-sub76.0%

        \[\leadsto t + -1 \cdot \color{blue}{\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}} \]
      4. mul-1-neg76.0%

        \[\leadsto t + \color{blue}{\left(-\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\right)} \]
      5. unsub-neg76.0%

        \[\leadsto \color{blue}{t - \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}} \]
      6. div-sub76.0%

        \[\leadsto t - \color{blue}{\left(\frac{y \cdot \left(t - x\right)}{z} - \frac{a \cdot \left(t - x\right)}{z}\right)} \]
      7. associate-/l*82.7%

        \[\leadsto t - \left(\color{blue}{y \cdot \frac{t - x}{z}} - \frac{a \cdot \left(t - x\right)}{z}\right) \]
      8. associate-/l*99.7%

        \[\leadsto t - \left(y \cdot \frac{t - x}{z} - \color{blue}{a \cdot \frac{t - x}{z}}\right) \]
      9. distribute-rgt-out--99.7%

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

      \[\leadsto \color{blue}{t - \frac{t - x}{z} \cdot \left(y - a\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -2 \cdot 10^{-249} \lor \neg \left(x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 5 \cdot 10^{-242}\right):\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{else}:\\ \;\;\;\;t + \frac{t - x}{z} \cdot \left(a - y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 38.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \frac{t - x}{a}\\ \mathbf{if}\;a \leq -8.5 \cdot 10^{+156}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -4.6 \cdot 10^{-129}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 1.38 \cdot 10^{-261}:\\ \;\;\;\;t\\ \mathbf{elif}\;a \leq 5.7 \cdot 10^{-154}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;a \leq 10^{+122}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* y (/ (- t x) a))))
   (if (<= a -8.5e+156)
     x
     (if (<= a -4.6e-129)
       t_1
       (if (<= a 1.38e-261)
         t
         (if (<= a 5.7e-154) (* x (/ y z)) (if (<= a 1e+122) t_1 x)))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = y * ((t - x) / a);
	double tmp;
	if (a <= -8.5e+156) {
		tmp = x;
	} else if (a <= -4.6e-129) {
		tmp = t_1;
	} else if (a <= 1.38e-261) {
		tmp = t;
	} else if (a <= 5.7e-154) {
		tmp = x * (y / z);
	} else if (a <= 1e+122) {
		tmp = t_1;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = y * ((t - x) / a)
    if (a <= (-8.5d+156)) then
        tmp = x
    else if (a <= (-4.6d-129)) then
        tmp = t_1
    else if (a <= 1.38d-261) then
        tmp = t
    else if (a <= 5.7d-154) then
        tmp = x * (y / z)
    else if (a <= 1d+122) then
        tmp = t_1
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = y * ((t - x) / a);
	double tmp;
	if (a <= -8.5e+156) {
		tmp = x;
	} else if (a <= -4.6e-129) {
		tmp = t_1;
	} else if (a <= 1.38e-261) {
		tmp = t;
	} else if (a <= 5.7e-154) {
		tmp = x * (y / z);
	} else if (a <= 1e+122) {
		tmp = t_1;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = y * ((t - x) / a)
	tmp = 0
	if a <= -8.5e+156:
		tmp = x
	elif a <= -4.6e-129:
		tmp = t_1
	elif a <= 1.38e-261:
		tmp = t
	elif a <= 5.7e-154:
		tmp = x * (y / z)
	elif a <= 1e+122:
		tmp = t_1
	else:
		tmp = x
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(y * Float64(Float64(t - x) / a))
	tmp = 0.0
	if (a <= -8.5e+156)
		tmp = x;
	elseif (a <= -4.6e-129)
		tmp = t_1;
	elseif (a <= 1.38e-261)
		tmp = t;
	elseif (a <= 5.7e-154)
		tmp = Float64(x * Float64(y / z));
	elseif (a <= 1e+122)
		tmp = t_1;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = y * ((t - x) / a);
	tmp = 0.0;
	if (a <= -8.5e+156)
		tmp = x;
	elseif (a <= -4.6e-129)
		tmp = t_1;
	elseif (a <= 1.38e-261)
		tmp = t;
	elseif (a <= 5.7e-154)
		tmp = x * (y / z);
	elseif (a <= 1e+122)
		tmp = t_1;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -8.5e+156], x, If[LessEqual[a, -4.6e-129], t$95$1, If[LessEqual[a, 1.38e-261], t, If[LessEqual[a, 5.7e-154], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1e+122], t$95$1, x]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot \frac{t - x}{a}\\
\mathbf{if}\;a \leq -8.5 \cdot 10^{+156}:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq -4.6 \cdot 10^{-129}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 1.38 \cdot 10^{-261}:\\
\;\;\;\;t\\

\mathbf{elif}\;a \leq 5.7 \cdot 10^{-154}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;a \leq 10^{+122}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -8.49999999999999948e156 or 1.00000000000000001e122 < a

    1. Initial program 89.0%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Step-by-step derivation
      1. +-commutative89.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified89.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 59.2%

      \[\leadsto \color{blue}{x} \]

    if -8.49999999999999948e156 < a < -4.5999999999999999e-129 or 5.6999999999999998e-154 < a < 1.00000000000000001e122

    1. Initial program 84.9%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 56.0%

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(t - x\right)}{a}} \]
    4. Taylor expanded in y around inf 46.9%

      \[\leadsto \color{blue}{y \cdot \left(\frac{t}{a} - \frac{x}{a}\right)} \]
    5. Step-by-step derivation
      1. div-sub46.9%

        \[\leadsto y \cdot \color{blue}{\frac{t - x}{a}} \]
    6. Simplified46.9%

      \[\leadsto \color{blue}{y \cdot \frac{t - x}{a}} \]

    if -4.5999999999999999e-129 < a < 1.38e-261

    1. Initial program 73.7%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num73.8%

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{1}{\frac{a - z}{t - x}}} \]
      2. un-div-inv74.8%

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    4. Applied egg-rr74.8%

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    5. Taylor expanded in z around inf 44.1%

      \[\leadsto \color{blue}{t} \]

    if 1.38e-261 < a < 5.6999999999999998e-154

    1. Initial program 77.0%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Step-by-step derivation
      1. +-commutative77.0%

        \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{t - x}{a - z} + x} \]
      2. fma-define77.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified77.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around 0 40.5%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{x \cdot \left(y - z\right)}{a - z}} \]
    6. Step-by-step derivation
      1. mul-1-neg40.5%

        \[\leadsto x + \color{blue}{\left(-\frac{x \cdot \left(y - z\right)}{a - z}\right)} \]
      2. *-rgt-identity40.5%

        \[\leadsto \color{blue}{x \cdot 1} + \left(-\frac{x \cdot \left(y - z\right)}{a - z}\right) \]
      3. associate-/l*40.5%

        \[\leadsto x \cdot 1 + \left(-\color{blue}{x \cdot \frac{y - z}{a - z}}\right) \]
      4. distribute-rgt-neg-in40.5%

        \[\leadsto x \cdot 1 + \color{blue}{x \cdot \left(-\frac{y - z}{a - z}\right)} \]
      5. mul-1-neg40.5%

        \[\leadsto x \cdot 1 + x \cdot \color{blue}{\left(-1 \cdot \frac{y - z}{a - z}\right)} \]
      6. distribute-lft-in40.5%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\frac{y - z}{a - z}\right)}\right) \]
      8. unsub-neg40.5%

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

      \[\leadsto \color{blue}{x \cdot \left(1 - \frac{y - z}{a - z}\right)} \]
    8. Taylor expanded in a around 0 49.6%

      \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 3: 34.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.8 \cdot 10^{-36}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 7.2 \cdot 10^{-262}:\\ \;\;\;\;t\\ \mathbf{elif}\;a \leq 7.5 \cdot 10^{-24}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;a \leq 2.2 \cdot 10^{+121}:\\ \;\;\;\;y \cdot \frac{t}{a}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -1.8e-36)
   x
   (if (<= a 7.2e-262)
     t
     (if (<= a 7.5e-24) (* x (/ y z)) (if (<= a 2.2e+121) (* y (/ t a)) x)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -1.8e-36) {
		tmp = x;
	} else if (a <= 7.2e-262) {
		tmp = t;
	} else if (a <= 7.5e-24) {
		tmp = x * (y / z);
	} else if (a <= 2.2e+121) {
		tmp = y * (t / a);
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (a <= (-1.8d-36)) then
        tmp = x
    else if (a <= 7.2d-262) then
        tmp = t
    else if (a <= 7.5d-24) then
        tmp = x * (y / z)
    else if (a <= 2.2d+121) then
        tmp = y * (t / a)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -1.8e-36) {
		tmp = x;
	} else if (a <= 7.2e-262) {
		tmp = t;
	} else if (a <= 7.5e-24) {
		tmp = x * (y / z);
	} else if (a <= 2.2e+121) {
		tmp = y * (t / a);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= -1.8e-36:
		tmp = x
	elif a <= 7.2e-262:
		tmp = t
	elif a <= 7.5e-24:
		tmp = x * (y / z)
	elif a <= 2.2e+121:
		tmp = y * (t / a)
	else:
		tmp = x
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -1.8e-36)
		tmp = x;
	elseif (a <= 7.2e-262)
		tmp = t;
	elseif (a <= 7.5e-24)
		tmp = Float64(x * Float64(y / z));
	elseif (a <= 2.2e+121)
		tmp = Float64(y * Float64(t / a));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (a <= -1.8e-36)
		tmp = x;
	elseif (a <= 7.2e-262)
		tmp = t;
	elseif (a <= 7.5e-24)
		tmp = x * (y / z);
	elseif (a <= 2.2e+121)
		tmp = y * (t / a);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.8e-36], x, If[LessEqual[a, 7.2e-262], t, If[LessEqual[a, 7.5e-24], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.2e+121], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.8 \cdot 10^{-36}:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq 7.2 \cdot 10^{-262}:\\
\;\;\;\;t\\

\mathbf{elif}\;a \leq 7.5 \cdot 10^{-24}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;a \leq 2.2 \cdot 10^{+121}:\\
\;\;\;\;y \cdot \frac{t}{a}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -1.80000000000000016e-36 or 2.20000000000000001e121 < a

    1. Initial program 88.0%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Step-by-step derivation
      1. +-commutative88.0%

        \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{t - x}{a - z} + x} \]
      2. fma-define88.1%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 49.2%

      \[\leadsto \color{blue}{x} \]

    if -1.80000000000000016e-36 < a < 7.1999999999999995e-262

    1. Initial program 71.7%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num71.6%

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{1}{\frac{a - z}{t - x}}} \]
      2. un-div-inv73.9%

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    4. Applied egg-rr73.9%

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    5. Taylor expanded in z around inf 38.1%

      \[\leadsto \color{blue}{t} \]

    if 7.1999999999999995e-262 < a < 7.50000000000000007e-24

    1. Initial program 80.4%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Step-by-step derivation
      1. +-commutative80.4%

        \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{t - x}{a - z} + x} \]
      2. fma-define80.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified80.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around 0 46.4%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{x \cdot \left(y - z\right)}{a - z}} \]
    6. Step-by-step derivation
      1. mul-1-neg46.4%

        \[\leadsto x + \color{blue}{\left(-\frac{x \cdot \left(y - z\right)}{a - z}\right)} \]
      2. *-rgt-identity46.4%

        \[\leadsto \color{blue}{x \cdot 1} + \left(-\frac{x \cdot \left(y - z\right)}{a - z}\right) \]
      3. associate-/l*46.5%

        \[\leadsto x \cdot 1 + \left(-\color{blue}{x \cdot \frac{y - z}{a - z}}\right) \]
      4. distribute-rgt-neg-in46.5%

        \[\leadsto x \cdot 1 + \color{blue}{x \cdot \left(-\frac{y - z}{a - z}\right)} \]
      5. mul-1-neg46.5%

        \[\leadsto x \cdot 1 + x \cdot \color{blue}{\left(-1 \cdot \frac{y - z}{a - z}\right)} \]
      6. distribute-lft-in46.6%

        \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{y - z}{a - z}\right)} \]
      7. mul-1-neg46.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\frac{y - z}{a - z}\right)}\right) \]
      8. unsub-neg46.6%

        \[\leadsto x \cdot \color{blue}{\left(1 - \frac{y - z}{a - z}\right)} \]
    7. Simplified46.6%

      \[\leadsto \color{blue}{x \cdot \left(1 - \frac{y - z}{a - z}\right)} \]
    8. Taylor expanded in a around 0 44.0%

      \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]

    if 7.50000000000000007e-24 < a < 2.20000000000000001e121

    1. Initial program 95.8%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 64.9%

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(t - x\right)}{a}} \]
    4. Taylor expanded in y around inf 58.4%

      \[\leadsto \color{blue}{y \cdot \left(\frac{t}{a} - \frac{x}{a}\right)} \]
    5. Step-by-step derivation
      1. div-sub58.4%

        \[\leadsto y \cdot \color{blue}{\frac{t - x}{a}} \]
    6. Simplified58.4%

      \[\leadsto \color{blue}{y \cdot \frac{t - x}{a}} \]
    7. Taylor expanded in t around inf 47.2%

      \[\leadsto y \cdot \color{blue}{\frac{t}{a}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 4: 36.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -7.5 \cdot 10^{-36}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 9.5 \cdot 10^{-260}:\\ \;\;\;\;t\\ \mathbf{elif}\;a \leq 8.4 \cdot 10^{-54}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;a \leq 3.8 \cdot 10^{+67}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -7.5e-36)
   x
   (if (<= a 9.5e-260)
     t
     (if (<= a 8.4e-54) (* x (/ y z)) (if (<= a 3.8e+67) t x)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -7.5e-36) {
		tmp = x;
	} else if (a <= 9.5e-260) {
		tmp = t;
	} else if (a <= 8.4e-54) {
		tmp = x * (y / z);
	} else if (a <= 3.8e+67) {
		tmp = t;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (a <= (-7.5d-36)) then
        tmp = x
    else if (a <= 9.5d-260) then
        tmp = t
    else if (a <= 8.4d-54) then
        tmp = x * (y / z)
    else if (a <= 3.8d+67) then
        tmp = t
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -7.5e-36) {
		tmp = x;
	} else if (a <= 9.5e-260) {
		tmp = t;
	} else if (a <= 8.4e-54) {
		tmp = x * (y / z);
	} else if (a <= 3.8e+67) {
		tmp = t;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= -7.5e-36:
		tmp = x
	elif a <= 9.5e-260:
		tmp = t
	elif a <= 8.4e-54:
		tmp = x * (y / z)
	elif a <= 3.8e+67:
		tmp = t
	else:
		tmp = x
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -7.5e-36)
		tmp = x;
	elseif (a <= 9.5e-260)
		tmp = t;
	elseif (a <= 8.4e-54)
		tmp = Float64(x * Float64(y / z));
	elseif (a <= 3.8e+67)
		tmp = t;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (a <= -7.5e-36)
		tmp = x;
	elseif (a <= 9.5e-260)
		tmp = t;
	elseif (a <= 8.4e-54)
		tmp = x * (y / z);
	elseif (a <= 3.8e+67)
		tmp = t;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -7.5e-36], x, If[LessEqual[a, 9.5e-260], t, If[LessEqual[a, 8.4e-54], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.8e+67], t, x]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.5 \cdot 10^{-36}:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq 9.5 \cdot 10^{-260}:\\
\;\;\;\;t\\

\mathbf{elif}\;a \leq 8.4 \cdot 10^{-54}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;a \leq 3.8 \cdot 10^{+67}:\\
\;\;\;\;t\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -7.49999999999999972e-36 or 3.8000000000000002e67 < a

    1. Initial program 89.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Step-by-step derivation
      1. +-commutative89.1%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified89.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 47.5%

      \[\leadsto \color{blue}{x} \]

    if -7.49999999999999972e-36 < a < 9.5000000000000001e-260 or 8.4e-54 < a < 3.8000000000000002e67

    1. Initial program 76.2%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num76.2%

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{1}{\frac{a - z}{t - x}}} \]
      2. un-div-inv77.8%

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    4. Applied egg-rr77.8%

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    5. Taylor expanded in z around inf 37.2%

      \[\leadsto \color{blue}{t} \]

    if 9.5000000000000001e-260 < a < 8.4e-54

    1. Initial program 82.2%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Step-by-step derivation
      1. +-commutative82.2%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified82.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around 0 46.8%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{x \cdot \left(y - z\right)}{a - z}} \]
    6. Step-by-step derivation
      1. mul-1-neg46.8%

        \[\leadsto x + \color{blue}{\left(-\frac{x \cdot \left(y - z\right)}{a - z}\right)} \]
      2. *-rgt-identity46.8%

        \[\leadsto \color{blue}{x \cdot 1} + \left(-\frac{x \cdot \left(y - z\right)}{a - z}\right) \]
      3. associate-/l*46.9%

        \[\leadsto x \cdot 1 + \left(-\color{blue}{x \cdot \frac{y - z}{a - z}}\right) \]
      4. distribute-rgt-neg-in46.9%

        \[\leadsto x \cdot 1 + \color{blue}{x \cdot \left(-\frac{y - z}{a - z}\right)} \]
      5. mul-1-neg46.9%

        \[\leadsto x \cdot 1 + x \cdot \color{blue}{\left(-1 \cdot \frac{y - z}{a - z}\right)} \]
      6. distribute-lft-in47.0%

        \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{y - z}{a - z}\right)} \]
      7. mul-1-neg47.0%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\frac{y - z}{a - z}\right)}\right) \]
      8. unsub-neg47.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - \frac{y - z}{a - z}\right)} \]
    7. Simplified47.0%

      \[\leadsto \color{blue}{x \cdot \left(1 - \frac{y - z}{a - z}\right)} \]
    8. Taylor expanded in a around 0 48.1%

      \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 78.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -85000000000 \lor \neg \left(z \leq 5.8 \cdot 10^{+124}\right):\\ \;\;\;\;t + \frac{t - x}{z} \cdot \left(a - y\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{a - z}{t - x}}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= z -85000000000.0) (not (<= z 5.8e+124)))
   (+ t (* (/ (- t x) z) (- a y)))
   (+ x (/ y (/ (- a z) (- t x))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -85000000000.0) || !(z <= 5.8e+124)) {
		tmp = t + (((t - x) / z) * (a - y));
	} else {
		tmp = x + (y / ((a - z) / (t - x)));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((z <= (-85000000000.0d0)) .or. (.not. (z <= 5.8d+124))) then
        tmp = t + (((t - x) / z) * (a - y))
    else
        tmp = x + (y / ((a - z) / (t - x)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -85000000000.0) || !(z <= 5.8e+124)) {
		tmp = t + (((t - x) / z) * (a - y));
	} else {
		tmp = x + (y / ((a - z) / (t - x)));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (z <= -85000000000.0) or not (z <= 5.8e+124):
		tmp = t + (((t - x) / z) * (a - y))
	else:
		tmp = x + (y / ((a - z) / (t - x)))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((z <= -85000000000.0) || !(z <= 5.8e+124))
		tmp = Float64(t + Float64(Float64(Float64(t - x) / z) * Float64(a - y)));
	else
		tmp = Float64(x + Float64(y / Float64(Float64(a - z) / Float64(t - x))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((z <= -85000000000.0) || ~((z <= 5.8e+124)))
		tmp = t + (((t - x) / z) * (a - y));
	else
		tmp = x + (y / ((a - z) / (t - x)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -85000000000.0], N[Not[LessEqual[z, 5.8e+124]], $MachinePrecision]], N[(t + N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(a - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(a - z), $MachinePrecision] / N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -85000000000 \lor \neg \left(z \leq 5.8 \cdot 10^{+124}\right):\\
\;\;\;\;t + \frac{t - x}{z} \cdot \left(a - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -8.5e10 or 5.80000000000000043e124 < z

    1. Initial program 64.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Step-by-step derivation
      1. +-commutative64.1%

        \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{t - x}{a - z} + x} \]
      2. fma-define64.1%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 59.8%

      \[\leadsto \color{blue}{\left(t + -1 \cdot \frac{y \cdot \left(t - x\right)}{z}\right) - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}} \]
    6. Step-by-step derivation
      1. associate--l+59.8%

        \[\leadsto \color{blue}{t + \left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}\right)} \]
      2. distribute-lft-out--59.8%

        \[\leadsto t + \color{blue}{-1 \cdot \left(\frac{y \cdot \left(t - x\right)}{z} - \frac{a \cdot \left(t - x\right)}{z}\right)} \]
      3. div-sub59.8%

        \[\leadsto t + -1 \cdot \color{blue}{\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}} \]
      4. mul-1-neg59.8%

        \[\leadsto t + \color{blue}{\left(-\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\right)} \]
      5. unsub-neg59.8%

        \[\leadsto \color{blue}{t - \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}} \]
      6. div-sub59.8%

        \[\leadsto t - \color{blue}{\left(\frac{y \cdot \left(t - x\right)}{z} - \frac{a \cdot \left(t - x\right)}{z}\right)} \]
      7. associate-/l*69.2%

        \[\leadsto t - \left(\color{blue}{y \cdot \frac{t - x}{z}} - \frac{a \cdot \left(t - x\right)}{z}\right) \]
      8. associate-/l*76.2%

        \[\leadsto t - \left(y \cdot \frac{t - x}{z} - \color{blue}{a \cdot \frac{t - x}{z}}\right) \]
      9. distribute-rgt-out--76.2%

        \[\leadsto t - \color{blue}{\frac{t - x}{z} \cdot \left(y - a\right)} \]
    7. Simplified76.2%

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

    if -8.5e10 < z < 5.80000000000000043e124

    1. Initial program 94.0%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num93.5%

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

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    4. Applied egg-rr94.4%

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    5. Taylor expanded in y around inf 85.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -85000000000 \lor \neg \left(z \leq 5.8 \cdot 10^{+124}\right):\\ \;\;\;\;t + \frac{t - x}{z} \cdot \left(a - y\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{a - z}{t - x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 73.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+157} \lor \neg \left(y \leq 19000000000\right):\\ \;\;\;\;x + \frac{y}{\frac{a - z}{t - x}}\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \frac{y - z}{a - z}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= y -4.8e+157) (not (<= y 19000000000.0)))
   (+ x (/ y (/ (- a z) (- t x))))
   (+ x (* t (/ (- y z) (- a z))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((y <= -4.8e+157) || !(y <= 19000000000.0)) {
		tmp = x + (y / ((a - z) / (t - x)));
	} else {
		tmp = x + (t * ((y - z) / (a - z)));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((y <= (-4.8d+157)) .or. (.not. (y <= 19000000000.0d0))) then
        tmp = x + (y / ((a - z) / (t - x)))
    else
        tmp = x + (t * ((y - z) / (a - z)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((y <= -4.8e+157) || !(y <= 19000000000.0)) {
		tmp = x + (y / ((a - z) / (t - x)));
	} else {
		tmp = x + (t * ((y - z) / (a - z)));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (y <= -4.8e+157) or not (y <= 19000000000.0):
		tmp = x + (y / ((a - z) / (t - x)))
	else:
		tmp = x + (t * ((y - z) / (a - z)))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((y <= -4.8e+157) || !(y <= 19000000000.0))
		tmp = Float64(x + Float64(y / Float64(Float64(a - z) / Float64(t - x))));
	else
		tmp = Float64(x + Float64(t * Float64(Float64(y - z) / Float64(a - z))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((y <= -4.8e+157) || ~((y <= 19000000000.0)))
		tmp = x + (y / ((a - z) / (t - x)));
	else
		tmp = x + (t * ((y - z) / (a - z)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -4.8e+157], N[Not[LessEqual[y, 19000000000.0]], $MachinePrecision]], N[(x + N[(y / N[(N[(a - z), $MachinePrecision] / N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+157} \lor \neg \left(y \leq 19000000000\right):\\
\;\;\;\;x + \frac{y}{\frac{a - z}{t - x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.7999999999999999e157 or 1.9e10 < y

    1. Initial program 90.0%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num89.5%

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

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    4. Applied egg-rr89.4%

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    5. Taylor expanded in y around inf 84.6%

      \[\leadsto x + \frac{\color{blue}{y}}{\frac{a - z}{t - x}} \]

    if -4.7999999999999999e157 < y < 1.9e10

    1. Initial program 78.6%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 62.6%

      \[\leadsto x + \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    4. Step-by-step derivation
      1. associate-/l*71.6%

        \[\leadsto x + \color{blue}{t \cdot \frac{y - z}{a - z}} \]
    5. Simplified71.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+157} \lor \neg \left(y \leq 19000000000\right):\\ \;\;\;\;x + \frac{y}{\frac{a - z}{t - x}}\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \frac{y - z}{a - z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 72.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -3.9 \cdot 10^{-157} \lor \neg \left(t \leq 2.95 \cdot 10^{-77}\right):\\ \;\;\;\;x + t \cdot \frac{y - z}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y - z}{z - a} + 1\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= t -3.9e-157) (not (<= t 2.95e-77)))
   (+ x (* t (/ (- y z) (- a z))))
   (* x (+ (/ (- y z) (- z a)) 1.0))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((t <= -3.9e-157) || !(t <= 2.95e-77)) {
		tmp = x + (t * ((y - z) / (a - z)));
	} else {
		tmp = x * (((y - z) / (z - a)) + 1.0);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((t <= (-3.9d-157)) .or. (.not. (t <= 2.95d-77))) then
        tmp = x + (t * ((y - z) / (a - z)))
    else
        tmp = x * (((y - z) / (z - a)) + 1.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((t <= -3.9e-157) || !(t <= 2.95e-77)) {
		tmp = x + (t * ((y - z) / (a - z)));
	} else {
		tmp = x * (((y - z) / (z - a)) + 1.0);
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (t <= -3.9e-157) or not (t <= 2.95e-77):
		tmp = x + (t * ((y - z) / (a - z)))
	else:
		tmp = x * (((y - z) / (z - a)) + 1.0)
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((t <= -3.9e-157) || !(t <= 2.95e-77))
		tmp = Float64(x + Float64(t * Float64(Float64(y - z) / Float64(a - z))));
	else
		tmp = Float64(x * Float64(Float64(Float64(y - z) / Float64(z - a)) + 1.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((t <= -3.9e-157) || ~((t <= 2.95e-77)))
		tmp = x + (t * ((y - z) / (a - z)));
	else
		tmp = x * (((y - z) / (z - a)) + 1.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.9e-157], N[Not[LessEqual[t, 2.95e-77]], $MachinePrecision]], N[(x + N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(N[(y - z), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.9 \cdot 10^{-157} \lor \neg \left(t \leq 2.95 \cdot 10^{-77}\right):\\
\;\;\;\;x + t \cdot \frac{y - z}{a - z}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y - z}{z - a} + 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.89999999999999999e-157 or 2.94999999999999982e-77 < t

    1. Initial program 90.2%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 66.5%

      \[\leadsto x + \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    4. Step-by-step derivation
      1. associate-/l*78.2%

        \[\leadsto x + \color{blue}{t \cdot \frac{y - z}{a - z}} \]
    5. Simplified78.2%

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

    if -3.89999999999999999e-157 < t < 2.94999999999999982e-77

    1. Initial program 67.4%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Step-by-step derivation
      1. +-commutative67.4%

        \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{t - x}{a - z} + x} \]
      2. fma-define67.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified67.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around 0 63.1%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{x \cdot \left(y - z\right)}{a - z}} \]
    6. Step-by-step derivation
      1. mul-1-neg63.1%

        \[\leadsto x + \color{blue}{\left(-\frac{x \cdot \left(y - z\right)}{a - z}\right)} \]
      2. *-rgt-identity63.1%

        \[\leadsto \color{blue}{x \cdot 1} + \left(-\frac{x \cdot \left(y - z\right)}{a - z}\right) \]
      3. associate-/l*68.8%

        \[\leadsto x \cdot 1 + \left(-\color{blue}{x \cdot \frac{y - z}{a - z}}\right) \]
      4. distribute-rgt-neg-in68.8%

        \[\leadsto x \cdot 1 + \color{blue}{x \cdot \left(-\frac{y - z}{a - z}\right)} \]
      5. mul-1-neg68.8%

        \[\leadsto x \cdot 1 + x \cdot \color{blue}{\left(-1 \cdot \frac{y - z}{a - z}\right)} \]
      6. distribute-lft-in68.7%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\frac{y - z}{a - z}\right)}\right) \]
      8. unsub-neg68.7%

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

      \[\leadsto \color{blue}{x \cdot \left(1 - \frac{y - z}{a - z}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.9 \cdot 10^{-157} \lor \neg \left(t \leq 2.95 \cdot 10^{-77}\right):\\ \;\;\;\;x + t \cdot \frac{y - z}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y - z}{z - a} + 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 62.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -4.7 \cdot 10^{-36} \lor \neg \left(a \leq 4.1 \cdot 10^{+67}\right):\\ \;\;\;\;x + y \cdot \frac{t - x}{a}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y - z}{a - z}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= a -4.7e-36) (not (<= a 4.1e+67)))
   (+ x (* y (/ (- t x) a)))
   (* t (/ (- y z) (- a z)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -4.7e-36) || !(a <= 4.1e+67)) {
		tmp = x + (y * ((t - x) / a));
	} else {
		tmp = t * ((y - z) / (a - z));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((a <= (-4.7d-36)) .or. (.not. (a <= 4.1d+67))) then
        tmp = x + (y * ((t - x) / a))
    else
        tmp = t * ((y - z) / (a - z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -4.7e-36) || !(a <= 4.1e+67)) {
		tmp = x + (y * ((t - x) / a));
	} else {
		tmp = t * ((y - z) / (a - z));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (a <= -4.7e-36) or not (a <= 4.1e+67):
		tmp = x + (y * ((t - x) / a))
	else:
		tmp = t * ((y - z) / (a - z))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((a <= -4.7e-36) || !(a <= 4.1e+67))
		tmp = Float64(x + Float64(y * Float64(Float64(t - x) / a)));
	else
		tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((a <= -4.7e-36) || ~((a <= 4.1e+67)))
		tmp = x + (y * ((t - x) / a));
	else
		tmp = t * ((y - z) / (a - z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -4.7e-36], N[Not[LessEqual[a, 4.1e+67]], $MachinePrecision]], N[(x + N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.7 \cdot 10^{-36} \lor \neg \left(a \leq 4.1 \cdot 10^{+67}\right):\\
\;\;\;\;x + y \cdot \frac{t - x}{a}\\

\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -4.7000000000000003e-36 or 4.09999999999999979e67 < a

    1. Initial program 89.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 68.2%

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(t - x\right)}{a}} \]
    4. Step-by-step derivation
      1. associate-/l*76.0%

        \[\leadsto x + \color{blue}{y \cdot \frac{t - x}{a}} \]
    5. Simplified76.0%

      \[\leadsto x + \color{blue}{y \cdot \frac{t - x}{a}} \]

    if -4.7000000000000003e-36 < a < 4.09999999999999979e67

    1. Initial program 78.0%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num78.1%

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

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    4. Applied egg-rr79.1%

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    5. Taylor expanded in t around inf 66.0%

      \[\leadsto \color{blue}{t \cdot \left(\left(-1 \cdot \frac{x \cdot \left(y - z\right)}{t \cdot \left(a - z\right)} + \left(\frac{x}{t} + \frac{y}{a - z}\right)\right) - \frac{z}{a - z}\right)} \]
    6. Step-by-step derivation
      1. +-commutative66.0%

        \[\leadsto t \cdot \left(\color{blue}{\left(\left(\frac{x}{t} + \frac{y}{a - z}\right) + -1 \cdot \frac{x \cdot \left(y - z\right)}{t \cdot \left(a - z\right)}\right)} - \frac{z}{a - z}\right) \]
      2. mul-1-neg66.0%

        \[\leadsto t \cdot \left(\left(\left(\frac{x}{t} + \frac{y}{a - z}\right) + \color{blue}{\left(-\frac{x \cdot \left(y - z\right)}{t \cdot \left(a - z\right)}\right)}\right) - \frac{z}{a - z}\right) \]
      3. unsub-neg66.0%

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

        \[\leadsto t \cdot \left(\left(\color{blue}{\left(\frac{y}{a - z} + \frac{x}{t}\right)} - \frac{x \cdot \left(y - z\right)}{t \cdot \left(a - z\right)}\right) - \frac{z}{a - z}\right) \]
      5. associate-/l*70.2%

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

      \[\leadsto \color{blue}{t \cdot \left(\left(\left(\frac{y}{a - z} + \frac{x}{t}\right) - x \cdot \frac{y - z}{t \cdot \left(a - z\right)}\right) - \frac{z}{a - z}\right)} \]
    8. Taylor expanded in t around inf 61.9%

      \[\leadsto \color{blue}{t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)} \]
    9. Step-by-step derivation
      1. div-sub61.9%

        \[\leadsto t \cdot \color{blue}{\frac{y - z}{a - z}} \]
    10. Simplified61.9%

      \[\leadsto \color{blue}{t \cdot \frac{y - z}{a - z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -4.7 \cdot 10^{-36} \lor \neg \left(a \leq 4.1 \cdot 10^{+67}\right):\\ \;\;\;\;x + y \cdot \frac{t - x}{a}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y - z}{a - z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 60.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -7.2 \cdot 10^{-19} \lor \neg \left(x \leq 7.8 \cdot 10^{+45}\right):\\ \;\;\;\;x - x \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y - z}{a - z}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= x -7.2e-19) (not (<= x 7.8e+45)))
   (- x (* x (/ y a)))
   (* t (/ (- y z) (- a z)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x <= -7.2e-19) || !(x <= 7.8e+45)) {
		tmp = x - (x * (y / a));
	} else {
		tmp = t * ((y - z) / (a - z));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((x <= (-7.2d-19)) .or. (.not. (x <= 7.8d+45))) then
        tmp = x - (x * (y / a))
    else
        tmp = t * ((y - z) / (a - z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x <= -7.2e-19) || !(x <= 7.8e+45)) {
		tmp = x - (x * (y / a));
	} else {
		tmp = t * ((y - z) / (a - z));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (x <= -7.2e-19) or not (x <= 7.8e+45):
		tmp = x - (x * (y / a))
	else:
		tmp = t * ((y - z) / (a - z))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((x <= -7.2e-19) || !(x <= 7.8e+45))
		tmp = Float64(x - Float64(x * Float64(y / a)));
	else
		tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((x <= -7.2e-19) || ~((x <= 7.8e+45)))
		tmp = x - (x * (y / a));
	else
		tmp = t * ((y - z) / (a - z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -7.2e-19], N[Not[LessEqual[x, 7.8e+45]], $MachinePrecision]], N[(x - N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-19} \lor \neg \left(x \leq 7.8 \cdot 10^{+45}\right):\\
\;\;\;\;x - x \cdot \frac{y}{a}\\

\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.2000000000000002e-19 or 7.7999999999999999e45 < x

    1. Initial program 81.7%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 55.5%

      \[\leadsto x + \color{blue}{-1 \cdot \frac{x \cdot \left(y - z\right)}{a - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg55.5%

        \[\leadsto x + \color{blue}{\left(-\frac{x \cdot \left(y - z\right)}{a - z}\right)} \]
      2. associate-/l*65.8%

        \[\leadsto x + \left(-\color{blue}{x \cdot \frac{y - z}{a - z}}\right) \]
      3. distribute-rgt-neg-in65.8%

        \[\leadsto x + \color{blue}{x \cdot \left(-\frac{y - z}{a - z}\right)} \]
      4. mul-1-neg65.8%

        \[\leadsto x + x \cdot \color{blue}{\left(-1 \cdot \frac{y - z}{a - z}\right)} \]
      5. mul-1-neg65.8%

        \[\leadsto x + x \cdot \color{blue}{\left(-\frac{y - z}{a - z}\right)} \]
      6. distribute-frac-neg265.8%

        \[\leadsto x + x \cdot \color{blue}{\frac{y - z}{-\left(a - z\right)}} \]
    5. Simplified65.8%

      \[\leadsto x + \color{blue}{x \cdot \frac{y - z}{-\left(a - z\right)}} \]
    6. Taylor expanded in z around 0 53.2%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{x \cdot y}{a}} \]
    7. Step-by-step derivation
      1. mul-1-neg53.2%

        \[\leadsto x + \color{blue}{\left(-\frac{x \cdot y}{a}\right)} \]
      2. unsub-neg53.2%

        \[\leadsto \color{blue}{x - \frac{x \cdot y}{a}} \]
      3. associate-/l*58.9%

        \[\leadsto x - \color{blue}{x \cdot \frac{y}{a}} \]
    8. Simplified58.9%

      \[\leadsto \color{blue}{x - x \cdot \frac{y}{a}} \]

    if -7.2000000000000002e-19 < x < 7.7999999999999999e45

    1. Initial program 84.9%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num83.0%

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{1}{\frac{a - z}{t - x}}} \]
      2. un-div-inv83.5%

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    4. Applied egg-rr83.5%

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    5. Taylor expanded in t around inf 87.7%

      \[\leadsto \color{blue}{t \cdot \left(\left(-1 \cdot \frac{x \cdot \left(y - z\right)}{t \cdot \left(a - z\right)} + \left(\frac{x}{t} + \frac{y}{a - z}\right)\right) - \frac{z}{a - z}\right)} \]
    6. Step-by-step derivation
      1. +-commutative87.7%

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

        \[\leadsto t \cdot \left(\left(\left(\frac{x}{t} + \frac{y}{a - z}\right) + \color{blue}{\left(-\frac{x \cdot \left(y - z\right)}{t \cdot \left(a - z\right)}\right)}\right) - \frac{z}{a - z}\right) \]
      3. unsub-neg87.7%

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

        \[\leadsto t \cdot \left(\left(\color{blue}{\left(\frac{y}{a - z} + \frac{x}{t}\right)} - \frac{x \cdot \left(y - z\right)}{t \cdot \left(a - z\right)}\right) - \frac{z}{a - z}\right) \]
      5. associate-/l*81.7%

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

      \[\leadsto \color{blue}{t \cdot \left(\left(\left(\frac{y}{a - z} + \frac{x}{t}\right) - x \cdot \frac{y - z}{t \cdot \left(a - z\right)}\right) - \frac{z}{a - z}\right)} \]
    8. Taylor expanded in t around inf 70.8%

      \[\leadsto \color{blue}{t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)} \]
    9. Step-by-step derivation
      1. div-sub70.8%

        \[\leadsto t \cdot \color{blue}{\frac{y - z}{a - z}} \]
    10. Simplified70.8%

      \[\leadsto \color{blue}{t \cdot \frac{y - z}{a - z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.2 \cdot 10^{-19} \lor \neg \left(x \leq 7.8 \cdot 10^{+45}\right):\\ \;\;\;\;x - x \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y - z}{a - z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 52.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.4 \cdot 10^{+52}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+129}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -4.4e+52) t (if (<= z 1.25e+129) (+ x (* t (/ y a))) t)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -4.4e+52) {
		tmp = t;
	} else if (z <= 1.25e+129) {
		tmp = x + (t * (y / a));
	} else {
		tmp = t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z <= (-4.4d+52)) then
        tmp = t
    else if (z <= 1.25d+129) then
        tmp = x + (t * (y / a))
    else
        tmp = t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -4.4e+52) {
		tmp = t;
	} else if (z <= 1.25e+129) {
		tmp = x + (t * (y / a));
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -4.4e+52:
		tmp = t
	elif z <= 1.25e+129:
		tmp = x + (t * (y / a))
	else:
		tmp = t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -4.4e+52)
		tmp = t;
	elseif (z <= 1.25e+129)
		tmp = Float64(x + Float64(t * Float64(y / a)));
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -4.4e+52)
		tmp = t;
	elseif (z <= 1.25e+129)
		tmp = x + (t * (y / a));
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.4e+52], t, If[LessEqual[z, 1.25e+129], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+52}:\\
\;\;\;\;t\\

\mathbf{elif}\;z \leq 1.25 \cdot 10^{+129}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\

\mathbf{else}:\\
\;\;\;\;t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.4e52 or 1.2500000000000001e129 < z

    1. Initial program 63.5%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num61.9%

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

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    4. Applied egg-rr61.7%

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    5. Taylor expanded in z around inf 46.0%

      \[\leadsto \color{blue}{t} \]

    if -4.4e52 < z < 1.2500000000000001e129

    1. Initial program 92.6%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 68.4%

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(t - x\right)}{a}} \]
    4. Taylor expanded in t around inf 55.5%

      \[\leadsto x + \color{blue}{\frac{t \cdot y}{a}} \]
    5. Step-by-step derivation
      1. associate-/l*59.0%

        \[\leadsto x + \color{blue}{t \cdot \frac{y}{a}} \]
    6. Simplified59.0%

      \[\leadsto x + \color{blue}{t \cdot \frac{y}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 36.7% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.1 \cdot 10^{-35}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 3.05 \cdot 10^{+69}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -1.1e-35) x (if (<= a 3.05e+69) t x)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -1.1e-35) {
		tmp = x;
	} else if (a <= 3.05e+69) {
		tmp = t;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (a <= (-1.1d-35)) then
        tmp = x
    else if (a <= 3.05d+69) then
        tmp = t
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -1.1e-35) {
		tmp = x;
	} else if (a <= 3.05e+69) {
		tmp = t;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= -1.1e-35:
		tmp = x
	elif a <= 3.05e+69:
		tmp = t
	else:
		tmp = x
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -1.1e-35)
		tmp = x;
	elseif (a <= 3.05e+69)
		tmp = t;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (a <= -1.1e-35)
		tmp = x;
	elseif (a <= 3.05e+69)
		tmp = t;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.1e-35], x, If[LessEqual[a, 3.05e+69], t, x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{-35}:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq 3.05 \cdot 10^{+69}:\\
\;\;\;\;t\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.09999999999999997e-35 or 3.05e69 < a

    1. Initial program 89.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Step-by-step derivation
      1. +-commutative89.1%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified89.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 47.5%

      \[\leadsto \color{blue}{x} \]

    if -1.09999999999999997e-35 < a < 3.05e69

    1. Initial program 78.0%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num78.1%

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

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    4. Applied egg-rr79.1%

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    5. Taylor expanded in z around inf 29.6%

      \[\leadsto \color{blue}{t} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 25.0% accurate, 13.0× speedup?

\[\begin{array}{l} \\ t \end{array} \]
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
	return t;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = t
end function
public static double code(double x, double y, double z, double t, double a) {
	return t;
}
def code(x, y, z, t, a):
	return t
function code(x, y, z, t, a)
	return t
end
function tmp = code(x, y, z, t, a)
	tmp = t;
end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}

\\
t
\end{array}
Derivation
  1. Initial program 83.3%

    \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. clear-num82.4%

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{1}{\frac{a - z}{t - x}}} \]
    2. un-div-inv82.9%

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
  4. Applied egg-rr82.9%

    \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
  5. Taylor expanded in z around inf 19.9%

    \[\leadsto \color{blue}{t} \]
  6. Add Preprocessing

Alternative 13: 2.8% accurate, 13.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (x y z t a) :precision binary64 0.0)
double code(double x, double y, double z, double t, double a) {
	return 0.0;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = 0.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
	return 0.0;
}
def code(x, y, z, t, a):
	return 0.0
function code(x, y, z, t, a)
	return 0.0
end
function tmp = code(x, y, z, t, a)
	tmp = 0.0;
end
code[x_, y_, z_, t_, a_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 83.3%

    \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
  2. Add Preprocessing
  3. Taylor expanded in t around 0 42.4%

    \[\leadsto x + \color{blue}{-1 \cdot \frac{x \cdot \left(y - z\right)}{a - z}} \]
  4. Step-by-step derivation
    1. mul-1-neg42.4%

      \[\leadsto x + \color{blue}{\left(-\frac{x \cdot \left(y - z\right)}{a - z}\right)} \]
    2. associate-/l*46.8%

      \[\leadsto x + \left(-\color{blue}{x \cdot \frac{y - z}{a - z}}\right) \]
    3. distribute-rgt-neg-in46.8%

      \[\leadsto x + \color{blue}{x \cdot \left(-\frac{y - z}{a - z}\right)} \]
    4. mul-1-neg46.8%

      \[\leadsto x + x \cdot \color{blue}{\left(-1 \cdot \frac{y - z}{a - z}\right)} \]
    5. mul-1-neg46.8%

      \[\leadsto x + x \cdot \color{blue}{\left(-\frac{y - z}{a - z}\right)} \]
    6. distribute-frac-neg246.8%

      \[\leadsto x + x \cdot \color{blue}{\frac{y - z}{-\left(a - z\right)}} \]
  5. Simplified46.8%

    \[\leadsto x + \color{blue}{x \cdot \frac{y - z}{-\left(a - z\right)}} \]
  6. Taylor expanded in z around inf 2.7%

    \[\leadsto \color{blue}{x + -1 \cdot x} \]
  7. Step-by-step derivation
    1. distribute-rgt1-in2.7%

      \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot x} \]
    2. metadata-eval2.7%

      \[\leadsto \color{blue}{0} \cdot x \]
  8. Simplified2.7%

    \[\leadsto \color{blue}{0 \cdot x} \]
  9. Taylor expanded in x around 0 2.7%

    \[\leadsto \color{blue}{0} \]
  10. Add Preprocessing

Reproduce

?
herbie shell --seed 2024170 
(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)))))