Numeric.Signal:interpolate from hsignal-0.2.7.1

Percentage Accurate: 80.5% → 90.5%
Time: 14.5s
Alternatives: 16
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 16 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: 80.5% 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.5% 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^{-274} \lor \neg \left(t\_1 \leq 2 \cdot 10^{-202}\right):\\ \;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\ \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-274) (not (<= t_1 2e-202)))
     (+ x (/ (- y z) (/ (- a z) (- t x))))
     (+ 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-274) || !(t_1 <= 2e-202)) {
		tmp = x + ((y - z) / ((a - z) / (t - x)));
	} 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-274)) .or. (.not. (t_1 <= 2d-202))) then
        tmp = x + ((y - z) / ((a - z) / (t - x)))
    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-274) || !(t_1 <= 2e-202)) {
		tmp = x + ((y - z) / ((a - z) / (t - x)));
	} 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-274) or not (t_1 <= 2e-202):
		tmp = x + ((y - z) / ((a - z) / (t - x)))
	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-274) || !(t_1 <= 2e-202))
		tmp = Float64(x + Float64(Float64(y - z) / Float64(Float64(a - z) / Float64(t - x))));
	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-274) || ~((t_1 <= 2e-202)))
		tmp = x + ((y - z) / ((a - z) / (t - x)));
	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-274], N[Not[LessEqual[t$95$1, 2e-202]], $MachinePrecision]], N[(x + N[(N[(y - z), $MachinePrecision] / N[(N[(a - z), $MachinePrecision] / N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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^{-274} \lor \neg \left(t\_1 \leq 2 \cdot 10^{-202}\right):\\
\;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\

\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)))) < -1.99999999999999993e-274 or 2.0000000000000001e-202 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 91.8%

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

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

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

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

    if -1.99999999999999993e-274 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2.0000000000000001e-202

    1. Initial program 6.8%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified7.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 78.6%

      \[\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+78.6%

        \[\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--78.6%

        \[\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-sub78.7%

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

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

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

        \[\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*87.7%

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

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

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

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

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

Alternative 2: 90.6% 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^{-274} \lor \neg \left(t\_1 \leq 2 \cdot 10^{-202}\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-274) (not (<= t_1 2e-202)))
     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-274) || !(t_1 <= 2e-202)) {
		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-274)) .or. (.not. (t_1 <= 2d-202))) 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-274) || !(t_1 <= 2e-202)) {
		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-274) or not (t_1 <= 2e-202):
		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-274) || !(t_1 <= 2e-202))
		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-274) || ~((t_1 <= 2e-202)))
		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-274], N[Not[LessEqual[t$95$1, 2e-202]], $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^{-274} \lor \neg \left(t\_1 \leq 2 \cdot 10^{-202}\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)))) < -1.99999999999999993e-274 or 2.0000000000000001e-202 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 91.8%

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

    if -1.99999999999999993e-274 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2.0000000000000001e-202

    1. Initial program 6.8%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified7.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 78.6%

      \[\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+78.6%

        \[\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--78.6%

        \[\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-sub78.7%

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

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

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

        \[\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*87.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -2 \cdot 10^{-274} \lor \neg \left(x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 2 \cdot 10^{-202}\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 3: 59.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+133}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-89}:\\ \;\;\;\;x \cdot \left(1 + \frac{y}{z - a}\right)\\ \mathbf{elif}\;z \leq 2.25 \cdot 10^{+57}:\\ \;\;\;\;x + y \cdot \frac{t - x}{a}\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{+188}:\\ \;\;\;\;x + t \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+267}:\\ \;\;\;\;x \cdot \frac{y - a}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -5.5e+133)
   t
   (if (<= z -7.8e-89)
     (* x (+ 1.0 (/ y (- z a))))
     (if (<= z 2.25e+57)
       (+ x (* y (/ (- t x) a)))
       (if (<= z 1.65e+188)
         (+ x (* t (- 1.0 (/ y z))))
         (if (<= z 2.6e+267) (* x (/ (- y a) z)) t))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -5.5e+133) {
		tmp = t;
	} else if (z <= -7.8e-89) {
		tmp = x * (1.0 + (y / (z - a)));
	} else if (z <= 2.25e+57) {
		tmp = x + (y * ((t - x) / a));
	} else if (z <= 1.65e+188) {
		tmp = x + (t * (1.0 - (y / z)));
	} else if (z <= 2.6e+267) {
		tmp = x * ((y - a) / z);
	} 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 <= (-5.5d+133)) then
        tmp = t
    else if (z <= (-7.8d-89)) then
        tmp = x * (1.0d0 + (y / (z - a)))
    else if (z <= 2.25d+57) then
        tmp = x + (y * ((t - x) / a))
    else if (z <= 1.65d+188) then
        tmp = x + (t * (1.0d0 - (y / z)))
    else if (z <= 2.6d+267) then
        tmp = x * ((y - a) / z)
    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 <= -5.5e+133) {
		tmp = t;
	} else if (z <= -7.8e-89) {
		tmp = x * (1.0 + (y / (z - a)));
	} else if (z <= 2.25e+57) {
		tmp = x + (y * ((t - x) / a));
	} else if (z <= 1.65e+188) {
		tmp = x + (t * (1.0 - (y / z)));
	} else if (z <= 2.6e+267) {
		tmp = x * ((y - a) / z);
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -5.5e+133:
		tmp = t
	elif z <= -7.8e-89:
		tmp = x * (1.0 + (y / (z - a)))
	elif z <= 2.25e+57:
		tmp = x + (y * ((t - x) / a))
	elif z <= 1.65e+188:
		tmp = x + (t * (1.0 - (y / z)))
	elif z <= 2.6e+267:
		tmp = x * ((y - a) / z)
	else:
		tmp = t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -5.5e+133)
		tmp = t;
	elseif (z <= -7.8e-89)
		tmp = Float64(x * Float64(1.0 + Float64(y / Float64(z - a))));
	elseif (z <= 2.25e+57)
		tmp = Float64(x + Float64(y * Float64(Float64(t - x) / a)));
	elseif (z <= 1.65e+188)
		tmp = Float64(x + Float64(t * Float64(1.0 - Float64(y / z))));
	elseif (z <= 2.6e+267)
		tmp = Float64(x * Float64(Float64(y - a) / z));
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -5.5e+133)
		tmp = t;
	elseif (z <= -7.8e-89)
		tmp = x * (1.0 + (y / (z - a)));
	elseif (z <= 2.25e+57)
		tmp = x + (y * ((t - x) / a));
	elseif (z <= 1.65e+188)
		tmp = x + (t * (1.0 - (y / z)));
	elseif (z <= 2.6e+267)
		tmp = x * ((y - a) / z);
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.5e+133], t, If[LessEqual[z, -7.8e-89], N[(x * N[(1.0 + N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.25e+57], N[(x + N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.65e+188], N[(x + N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+267], N[(x * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -7.8 \cdot 10^{-89}:\\
\;\;\;\;x \cdot \left(1 + \frac{y}{z - a}\right)\\

\mathbf{elif}\;z \leq 2.25 \cdot 10^{+57}:\\
\;\;\;\;x + y \cdot \frac{t - x}{a}\\

\mathbf{elif}\;z \leq 1.65 \cdot 10^{+188}:\\
\;\;\;\;x + t \cdot \left(1 - \frac{y}{z}\right)\\

\mathbf{elif}\;z \leq 2.6 \cdot 10^{+267}:\\
\;\;\;\;x \cdot \frac{y - a}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -5.5e133 or 2.60000000000000002e267 < z

    1. Initial program 60.0%

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

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

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

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

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

    if -5.5e133 < z < -7.79999999999999957e-89

    1. Initial program 89.8%

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

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

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

      \[\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 51.9%

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

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

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

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

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

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

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

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

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

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

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

    if -7.79999999999999957e-89 < z < 2.24999999999999998e57

    1. Initial program 90.9%

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

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

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

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

    if 2.24999999999999998e57 < z < 1.64999999999999991e188

    1. Initial program 79.3%

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

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

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

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

      \[\leadsto x + \frac{y - z}{\color{blue}{\frac{a - z}{t}}} \]
    6. Taylor expanded in a around 0 53.5%

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

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

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

        \[\leadsto x - \color{blue}{t \cdot \frac{y - z}{z}} \]
      4. div-sub56.9%

        \[\leadsto x - t \cdot \color{blue}{\left(\frac{y}{z} - \frac{z}{z}\right)} \]
      5. *-inverses56.9%

        \[\leadsto x - t \cdot \left(\frac{y}{z} - \color{blue}{1}\right) \]
    8. Simplified56.9%

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

    if 1.64999999999999991e188 < z < 2.60000000000000002e267

    1. Initial program 25.7%

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

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

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

      \[\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 2.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(-\frac{\color{blue}{a - y}}{z}\right) \]
    10. Simplified66.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+133}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-89}:\\ \;\;\;\;x \cdot \left(1 + \frac{y}{z - a}\right)\\ \mathbf{elif}\;z \leq 2.25 \cdot 10^{+57}:\\ \;\;\;\;x + y \cdot \frac{t - x}{a}\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{+188}:\\ \;\;\;\;x + t \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+267}:\\ \;\;\;\;x \cdot \frac{y - a}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 59.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+133}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq -2.35 \cdot 10^{-89}:\\ \;\;\;\;x \cdot \left(1 + \frac{y}{z - a}\right)\\ \mathbf{elif}\;z \leq 8.6 \cdot 10^{-85}:\\ \;\;\;\;x + y \cdot \frac{t - x}{a}\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+140}:\\ \;\;\;\;x + t \cdot \frac{y}{a - z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -3.8e+133)
   t
   (if (<= z -2.35e-89)
     (* x (+ 1.0 (/ y (- z a))))
     (if (<= z 8.6e-85)
       (+ x (* y (/ (- t x) a)))
       (if (<= z 3.3e+140) (+ x (* t (/ y (- a z)))) t)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -3.8e+133) {
		tmp = t;
	} else if (z <= -2.35e-89) {
		tmp = x * (1.0 + (y / (z - a)));
	} else if (z <= 8.6e-85) {
		tmp = x + (y * ((t - x) / a));
	} else if (z <= 3.3e+140) {
		tmp = x + (t * (y / (a - z)));
	} 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 <= (-3.8d+133)) then
        tmp = t
    else if (z <= (-2.35d-89)) then
        tmp = x * (1.0d0 + (y / (z - a)))
    else if (z <= 8.6d-85) then
        tmp = x + (y * ((t - x) / a))
    else if (z <= 3.3d+140) then
        tmp = x + (t * (y / (a - z)))
    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 <= -3.8e+133) {
		tmp = t;
	} else if (z <= -2.35e-89) {
		tmp = x * (1.0 + (y / (z - a)));
	} else if (z <= 8.6e-85) {
		tmp = x + (y * ((t - x) / a));
	} else if (z <= 3.3e+140) {
		tmp = x + (t * (y / (a - z)));
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -3.8e+133:
		tmp = t
	elif z <= -2.35e-89:
		tmp = x * (1.0 + (y / (z - a)))
	elif z <= 8.6e-85:
		tmp = x + (y * ((t - x) / a))
	elif z <= 3.3e+140:
		tmp = x + (t * (y / (a - z)))
	else:
		tmp = t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -3.8e+133)
		tmp = t;
	elseif (z <= -2.35e-89)
		tmp = Float64(x * Float64(1.0 + Float64(y / Float64(z - a))));
	elseif (z <= 8.6e-85)
		tmp = Float64(x + Float64(y * Float64(Float64(t - x) / a)));
	elseif (z <= 3.3e+140)
		tmp = Float64(x + Float64(t * Float64(y / Float64(a - z))));
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -3.8e+133)
		tmp = t;
	elseif (z <= -2.35e-89)
		tmp = x * (1.0 + (y / (z - a)));
	elseif (z <= 8.6e-85)
		tmp = x + (y * ((t - x) / a));
	elseif (z <= 3.3e+140)
		tmp = x + (t * (y / (a - z)));
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.8e+133], t, If[LessEqual[z, -2.35e-89], N[(x * N[(1.0 + N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.6e-85], N[(x + N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.3e+140], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.35 \cdot 10^{-89}:\\
\;\;\;\;x \cdot \left(1 + \frac{y}{z - a}\right)\\

\mathbf{elif}\;z \leq 8.6 \cdot 10^{-85}:\\
\;\;\;\;x + y \cdot \frac{t - x}{a}\\

\mathbf{elif}\;z \leq 3.3 \cdot 10^{+140}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -3.8000000000000002e133 or 3.3000000000000002e140 < z

    1. Initial program 56.0%

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

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

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

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

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

    if -3.8000000000000002e133 < z < -2.34999999999999998e-89

    1. Initial program 89.8%

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

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

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

      \[\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 51.9%

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

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

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

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

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

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

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

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

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

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

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

    if -2.34999999999999998e-89 < z < 8.59999999999999998e-85

    1. Initial program 91.2%

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

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

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

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

    if 8.59999999999999998e-85 < z < 3.3000000000000002e140

    1. Initial program 85.0%

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

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

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

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

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

        \[\leadsto x + \color{blue}{t \cdot \frac{y}{a - z}} \]
    8. Simplified57.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+133}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq -2.35 \cdot 10^{-89}:\\ \;\;\;\;x \cdot \left(1 + \frac{y}{z - a}\right)\\ \mathbf{elif}\;z \leq 8.6 \cdot 10^{-85}:\\ \;\;\;\;x + y \cdot \frac{t - x}{a}\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+140}:\\ \;\;\;\;x + t \cdot \frac{y}{a - z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 59.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -150000000000:\\ \;\;\;\;x - t \cdot \frac{z}{a - z}\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+57}:\\ \;\;\;\;x + y \cdot \frac{t - x}{a}\\ \mathbf{elif}\;z \leq 3.05 \cdot 10^{+187}:\\ \;\;\;\;x + t \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+267}:\\ \;\;\;\;x \cdot \frac{y - a}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -150000000000.0)
   (- x (* t (/ z (- a z))))
   (if (<= z 1.9e+57)
     (+ x (* y (/ (- t x) a)))
     (if (<= z 3.05e+187)
       (+ x (* t (- 1.0 (/ y z))))
       (if (<= z 2.6e+267) (* x (/ (- y a) z)) t)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -150000000000.0) {
		tmp = x - (t * (z / (a - z)));
	} else if (z <= 1.9e+57) {
		tmp = x + (y * ((t - x) / a));
	} else if (z <= 3.05e+187) {
		tmp = x + (t * (1.0 - (y / z)));
	} else if (z <= 2.6e+267) {
		tmp = x * ((y - a) / z);
	} 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 <= (-150000000000.0d0)) then
        tmp = x - (t * (z / (a - z)))
    else if (z <= 1.9d+57) then
        tmp = x + (y * ((t - x) / a))
    else if (z <= 3.05d+187) then
        tmp = x + (t * (1.0d0 - (y / z)))
    else if (z <= 2.6d+267) then
        tmp = x * ((y - a) / z)
    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 <= -150000000000.0) {
		tmp = x - (t * (z / (a - z)));
	} else if (z <= 1.9e+57) {
		tmp = x + (y * ((t - x) / a));
	} else if (z <= 3.05e+187) {
		tmp = x + (t * (1.0 - (y / z)));
	} else if (z <= 2.6e+267) {
		tmp = x * ((y - a) / z);
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -150000000000.0:
		tmp = x - (t * (z / (a - z)))
	elif z <= 1.9e+57:
		tmp = x + (y * ((t - x) / a))
	elif z <= 3.05e+187:
		tmp = x + (t * (1.0 - (y / z)))
	elif z <= 2.6e+267:
		tmp = x * ((y - a) / z)
	else:
		tmp = t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -150000000000.0)
		tmp = Float64(x - Float64(t * Float64(z / Float64(a - z))));
	elseif (z <= 1.9e+57)
		tmp = Float64(x + Float64(y * Float64(Float64(t - x) / a)));
	elseif (z <= 3.05e+187)
		tmp = Float64(x + Float64(t * Float64(1.0 - Float64(y / z))));
	elseif (z <= 2.6e+267)
		tmp = Float64(x * Float64(Float64(y - a) / z));
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -150000000000.0)
		tmp = x - (t * (z / (a - z)));
	elseif (z <= 1.9e+57)
		tmp = x + (y * ((t - x) / a));
	elseif (z <= 3.05e+187)
		tmp = x + (t * (1.0 - (y / z)));
	elseif (z <= 2.6e+267)
		tmp = x * ((y - a) / z);
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -150000000000.0], N[(x - N[(t * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e+57], N[(x + N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.05e+187], N[(x + N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+267], N[(x * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -150000000000:\\
\;\;\;\;x - t \cdot \frac{z}{a - z}\\

\mathbf{elif}\;z \leq 1.9 \cdot 10^{+57}:\\
\;\;\;\;x + y \cdot \frac{t - x}{a}\\

\mathbf{elif}\;z \leq 3.05 \cdot 10^{+187}:\\
\;\;\;\;x + t \cdot \left(1 - \frac{y}{z}\right)\\

\mathbf{elif}\;z \leq 2.6 \cdot 10^{+267}:\\
\;\;\;\;x \cdot \frac{y - a}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -1.5e11

    1. Initial program 73.4%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - z \cdot \frac{t - x}{a - z}} \]
    7. Simplified55.8%

      \[\leadsto \color{blue}{x - z \cdot \frac{t - x}{a - z}} \]
    8. Taylor expanded in t around inf 36.5%

      \[\leadsto x - \color{blue}{\frac{t \cdot z}{a - z}} \]
    9. Step-by-step derivation
      1. associate-/l*55.1%

        \[\leadsto x - \color{blue}{t \cdot \frac{z}{a - z}} \]
    10. Simplified55.1%

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

    if -1.5e11 < z < 1.8999999999999999e57

    1. Initial program 91.4%

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

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

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

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

    if 1.8999999999999999e57 < z < 3.0499999999999998e187

    1. Initial program 79.3%

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

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

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

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

      \[\leadsto x + \frac{y - z}{\color{blue}{\frac{a - z}{t}}} \]
    6. Taylor expanded in a around 0 53.5%

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

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

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

        \[\leadsto x - \color{blue}{t \cdot \frac{y - z}{z}} \]
      4. div-sub56.9%

        \[\leadsto x - t \cdot \color{blue}{\left(\frac{y}{z} - \frac{z}{z}\right)} \]
      5. *-inverses56.9%

        \[\leadsto x - t \cdot \left(\frac{y}{z} - \color{blue}{1}\right) \]
    8. Simplified56.9%

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

    if 3.0499999999999998e187 < z < 2.60000000000000002e267

    1. Initial program 25.7%

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

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

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

      \[\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 2.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(-\frac{\color{blue}{a - y}}{z}\right) \]
    10. Simplified66.3%

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

    if 2.60000000000000002e267 < z

    1. Initial program 52.9%

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

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

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

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

      \[\leadsto \color{blue}{t} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification67.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -150000000000:\\ \;\;\;\;x - t \cdot \frac{z}{a - z}\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+57}:\\ \;\;\;\;x + y \cdot \frac{t - x}{a}\\ \mathbf{elif}\;z \leq 3.05 \cdot 10^{+187}:\\ \;\;\;\;x + t \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+267}:\\ \;\;\;\;x \cdot \frac{y - a}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 56.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.8 \cdot 10^{+133}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{-115}:\\ \;\;\;\;x \cdot \left(1 + \frac{y}{z - a}\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+133}:\\ \;\;\;\;x + t \cdot \frac{y}{a - z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -2.8e+133)
   t
   (if (<= z -1.9e-115)
     (* x (+ 1.0 (/ y (- z a))))
     (if (<= z 1.8e+133) (+ x (* t (/ y (- a z)))) t))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -2.8e+133) {
		tmp = t;
	} else if (z <= -1.9e-115) {
		tmp = x * (1.0 + (y / (z - a)));
	} else if (z <= 1.8e+133) {
		tmp = x + (t * (y / (a - z)));
	} 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 <= (-2.8d+133)) then
        tmp = t
    else if (z <= (-1.9d-115)) then
        tmp = x * (1.0d0 + (y / (z - a)))
    else if (z <= 1.8d+133) then
        tmp = x + (t * (y / (a - z)))
    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 <= -2.8e+133) {
		tmp = t;
	} else if (z <= -1.9e-115) {
		tmp = x * (1.0 + (y / (z - a)));
	} else if (z <= 1.8e+133) {
		tmp = x + (t * (y / (a - z)));
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -2.8e+133:
		tmp = t
	elif z <= -1.9e-115:
		tmp = x * (1.0 + (y / (z - a)))
	elif z <= 1.8e+133:
		tmp = x + (t * (y / (a - z)))
	else:
		tmp = t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -2.8e+133)
		tmp = t;
	elseif (z <= -1.9e-115)
		tmp = Float64(x * Float64(1.0 + Float64(y / Float64(z - a))));
	elseif (z <= 1.8e+133)
		tmp = Float64(x + Float64(t * Float64(y / Float64(a - z))));
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -2.8e+133)
		tmp = t;
	elseif (z <= -1.9e-115)
		tmp = x * (1.0 + (y / (z - a)));
	elseif (z <= 1.8e+133)
		tmp = x + (t * (y / (a - z)));
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.8e+133], t, If[LessEqual[z, -1.9e-115], N[(x * N[(1.0 + N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e+133], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.9 \cdot 10^{-115}:\\
\;\;\;\;x \cdot \left(1 + \frac{y}{z - a}\right)\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{+133}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.80000000000000016e133 or 1.79999999999999989e133 < z

    1. Initial program 56.0%

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

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

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

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

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

    if -2.80000000000000016e133 < z < -1.89999999999999996e-115

    1. Initial program 89.4%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified89.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 54.5%

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

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

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

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

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

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

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

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

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

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

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

    if -1.89999999999999996e-115 < z < 1.79999999999999989e133

    1. Initial program 89.4%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.8 \cdot 10^{+133}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{-115}:\\ \;\;\;\;x \cdot \left(1 + \frac{y}{z - a}\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+133}:\\ \;\;\;\;x + t \cdot \frac{y}{a - z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 53.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6.6 \cdot 10^{+133}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-125}:\\ \;\;\;\;x \cdot \left(1 + \frac{y}{z - a}\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+57}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -6.6e+133)
   t
   (if (<= z -1.2e-125)
     (* x (+ 1.0 (/ y (- z a))))
     (if (<= z 1.8e+57) (+ x (* t (/ y a))) t))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -6.6e+133) {
		tmp = t;
	} else if (z <= -1.2e-125) {
		tmp = x * (1.0 + (y / (z - a)));
	} else if (z <= 1.8e+57) {
		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 <= (-6.6d+133)) then
        tmp = t
    else if (z <= (-1.2d-125)) then
        tmp = x * (1.0d0 + (y / (z - a)))
    else if (z <= 1.8d+57) 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 <= -6.6e+133) {
		tmp = t;
	} else if (z <= -1.2e-125) {
		tmp = x * (1.0 + (y / (z - a)));
	} else if (z <= 1.8e+57) {
		tmp = x + (t * (y / a));
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -6.6e+133:
		tmp = t
	elif z <= -1.2e-125:
		tmp = x * (1.0 + (y / (z - a)))
	elif z <= 1.8e+57:
		tmp = x + (t * (y / a))
	else:
		tmp = t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -6.6e+133)
		tmp = t;
	elseif (z <= -1.2e-125)
		tmp = Float64(x * Float64(1.0 + Float64(y / Float64(z - a))));
	elseif (z <= 1.8e+57)
		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 <= -6.6e+133)
		tmp = t;
	elseif (z <= -1.2e-125)
		tmp = x * (1.0 + (y / (z - a)));
	elseif (z <= 1.8e+57)
		tmp = x + (t * (y / a));
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.6e+133], t, If[LessEqual[z, -1.2e-125], N[(x * N[(1.0 + N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e+57], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.2 \cdot 10^{-125}:\\
\;\;\;\;x \cdot \left(1 + \frac{y}{z - a}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.6e133 or 1.8000000000000001e57 < z

    1. Initial program 60.9%

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

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

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

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

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

    if -6.6e133 < z < -1.2000000000000001e-125

    1. Initial program 90.5%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified90.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 54.3%

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

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

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

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

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

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

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

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

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

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

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

    if -1.2000000000000001e-125 < z < 1.8000000000000001e57

    1. Initial program 90.6%

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

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

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

      \[\leadsto \color{blue}{x + \frac{t \cdot y}{a}} \]
    6. Step-by-step derivation
      1. +-commutative62.9%

        \[\leadsto \color{blue}{\frac{t \cdot y}{a} + x} \]
      2. associate-/l*67.6%

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

      \[\leadsto \color{blue}{t \cdot \frac{y}{a} + x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification59.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.6 \cdot 10^{+133}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-125}:\\ \;\;\;\;x \cdot \left(1 + \frac{y}{z - a}\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+57}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 51.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.4 \cdot 10^{+133}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{-125}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{a}\right)\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{+57}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -2.4e+133)
   t
   (if (<= z -1.35e-125)
     (* x (- 1.0 (/ y a)))
     (if (<= z 1.6e+57) (+ x (* t (/ y a))) t))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -2.4e+133) {
		tmp = t;
	} else if (z <= -1.35e-125) {
		tmp = x * (1.0 - (y / a));
	} else if (z <= 1.6e+57) {
		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 <= (-2.4d+133)) then
        tmp = t
    else if (z <= (-1.35d-125)) then
        tmp = x * (1.0d0 - (y / a))
    else if (z <= 1.6d+57) 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 <= -2.4e+133) {
		tmp = t;
	} else if (z <= -1.35e-125) {
		tmp = x * (1.0 - (y / a));
	} else if (z <= 1.6e+57) {
		tmp = x + (t * (y / a));
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -2.4e+133:
		tmp = t
	elif z <= -1.35e-125:
		tmp = x * (1.0 - (y / a))
	elif z <= 1.6e+57:
		tmp = x + (t * (y / a))
	else:
		tmp = t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -2.4e+133)
		tmp = t;
	elseif (z <= -1.35e-125)
		tmp = Float64(x * Float64(1.0 - Float64(y / a)));
	elseif (z <= 1.6e+57)
		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 <= -2.4e+133)
		tmp = t;
	elseif (z <= -1.35e-125)
		tmp = x * (1.0 - (y / a));
	elseif (z <= 1.6e+57)
		tmp = x + (t * (y / a));
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.4e+133], t, If[LessEqual[z, -1.35e-125], N[(x * N[(1.0 - N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e+57], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.35 \cdot 10^{-125}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{a}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.3999999999999999e133 or 1.60000000000000015e57 < z

    1. Initial program 60.9%

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

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

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

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

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

    if -2.3999999999999999e133 < z < -1.3499999999999999e-125

    1. Initial program 90.5%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified90.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 54.3%

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

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

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

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

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

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

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

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

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

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

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

    if -1.3499999999999999e-125 < z < 1.60000000000000015e57

    1. Initial program 90.6%

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

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

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

      \[\leadsto \color{blue}{x + \frac{t \cdot y}{a}} \]
    6. Step-by-step derivation
      1. +-commutative62.9%

        \[\leadsto \color{blue}{\frac{t \cdot y}{a} + x} \]
      2. associate-/l*67.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.4 \cdot 10^{+133}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{-125}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{a}\right)\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{+57}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 50.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+133}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{-126}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{a}\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+57}:\\ \;\;\;\;x + \frac{y \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -4.3e+133)
   t
   (if (<= z -2.3e-126)
     (* x (- 1.0 (/ y a)))
     (if (<= z 1.8e+57) (+ x (/ (* y t) a)) t))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -4.3e+133) {
		tmp = t;
	} else if (z <= -2.3e-126) {
		tmp = x * (1.0 - (y / a));
	} else if (z <= 1.8e+57) {
		tmp = x + ((y * t) / 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.3d+133)) then
        tmp = t
    else if (z <= (-2.3d-126)) then
        tmp = x * (1.0d0 - (y / a))
    else if (z <= 1.8d+57) then
        tmp = x + ((y * t) / 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.3e+133) {
		tmp = t;
	} else if (z <= -2.3e-126) {
		tmp = x * (1.0 - (y / a));
	} else if (z <= 1.8e+57) {
		tmp = x + ((y * t) / a);
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -4.3e+133:
		tmp = t
	elif z <= -2.3e-126:
		tmp = x * (1.0 - (y / a))
	elif z <= 1.8e+57:
		tmp = x + ((y * t) / a)
	else:
		tmp = t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -4.3e+133)
		tmp = t;
	elseif (z <= -2.3e-126)
		tmp = Float64(x * Float64(1.0 - Float64(y / a)));
	elseif (z <= 1.8e+57)
		tmp = Float64(x + Float64(Float64(y * t) / a));
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -4.3e+133)
		tmp = t;
	elseif (z <= -2.3e-126)
		tmp = x * (1.0 - (y / a));
	elseif (z <= 1.8e+57)
		tmp = x + ((y * t) / a);
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.3e+133], t, If[LessEqual[z, -2.3e-126], N[(x * N[(1.0 - N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e+57], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.3 \cdot 10^{-126}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{a}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.29999999999999994e133 or 1.8000000000000001e57 < z

    1. Initial program 60.9%

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

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

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

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

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

    if -4.29999999999999994e133 < z < -2.30000000000000011e-126

    1. Initial program 90.5%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Simplified90.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 54.3%

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

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

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

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

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

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

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

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

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

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

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

    if -2.30000000000000011e-126 < z < 1.8000000000000001e57

    1. Initial program 90.6%

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

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

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

      \[\leadsto x + \color{blue}{t \cdot \frac{y - z}{a - z}} \]
    6. Taylor expanded in z around 0 62.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+133}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{-126}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{a}\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+57}:\\ \;\;\;\;x + \frac{y \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 79.7% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.8000000000000003e82 or 8.99999999999999968e54 < z

    1. Initial program 63.8%

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

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

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

      \[\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 65.7%

      \[\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+65.7%

        \[\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--65.7%

        \[\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-sub65.7%

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

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

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

        \[\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*70.7%

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

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

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

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

    if -5.8000000000000003e82 < z < 8.99999999999999968e54

    1. Initial program 90.6%

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

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

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

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

        \[\leadsto x + \color{blue}{\frac{t - x}{1} \cdot \frac{y}{a - z}} \]
      4. /-rgt-identity85.4%

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

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

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

Alternative 11: 73.0% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.5e11 or 4.10000000000000001e-94 < z

    1. Initial program 71.8%

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

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

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

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

    if -7.5e11 < z < 4.10000000000000001e-94

    1. Initial program 92.5%

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

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

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

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

        \[\leadsto x + \color{blue}{\frac{t - x}{1} \cdot \frac{y}{a - z}} \]
      4. /-rgt-identity93.3%

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

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

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

Alternative 12: 71.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{+66} \lor \neg \left(x \leq 8.5 \cdot 10^{+60}\right):\\ \;\;\;\;x \cdot \left(1 + \frac{y - z}{z - a}\right)\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \frac{y - z}{a - z}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= x -1.35e+66) (not (<= x 8.5e+60)))
   (* x (+ 1.0 (/ (- y z) (- z a))))
   (+ x (* t (/ (- y z) (- a z))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x <= -1.35e+66) || !(x <= 8.5e+60)) {
		tmp = x * (1.0 + ((y - z) / (z - a)));
	} 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 ((x <= (-1.35d+66)) .or. (.not. (x <= 8.5d+60))) then
        tmp = x * (1.0d0 + ((y - z) / (z - a)))
    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 ((x <= -1.35e+66) || !(x <= 8.5e+60)) {
		tmp = x * (1.0 + ((y - z) / (z - a)));
	} else {
		tmp = x + (t * ((y - z) / (a - z)));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (x <= -1.35e+66) or not (x <= 8.5e+60):
		tmp = x * (1.0 + ((y - z) / (z - a)))
	else:
		tmp = x + (t * ((y - z) / (a - z)))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((x <= -1.35e+66) || !(x <= 8.5e+60))
		tmp = Float64(x * Float64(1.0 + Float64(Float64(y - z) / Float64(z - a))));
	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 ((x <= -1.35e+66) || ~((x <= 8.5e+60)))
		tmp = x * (1.0 + ((y - z) / (z - a)));
	else
		tmp = x + (t * ((y - z) / (a - z)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -1.35e+66], N[Not[LessEqual[x, 8.5e+60]], $MachinePrecision]], N[(x * N[(1.0 + N[(N[(y - z), $MachinePrecision] / N[(z - a), $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}\;x \leq -1.35 \cdot 10^{+66} \lor \neg \left(x \leq 8.5 \cdot 10^{+60}\right):\\
\;\;\;\;x \cdot \left(1 + \frac{y - z}{z - a}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.35e66 or 8.50000000000000064e60 < x

    1. Initial program 70.9%

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

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

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

      \[\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 55.4%

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

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

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

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

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

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

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

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

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

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

    if -1.35e66 < x < 8.50000000000000064e60

    1. Initial program 87.4%

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

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

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

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

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

Alternative 13: 48.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.9 \cdot 10^{+134}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+57}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -1.9e+134) t (if (<= z 6.2e+57) (* x (- 1.0 (/ y a))) t)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -1.9e+134) {
		tmp = t;
	} else if (z <= 6.2e+57) {
		tmp = x * (1.0 - (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 <= (-1.9d+134)) then
        tmp = t
    else if (z <= 6.2d+57) then
        tmp = x * (1.0d0 - (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 <= -1.9e+134) {
		tmp = t;
	} else if (z <= 6.2e+57) {
		tmp = x * (1.0 - (y / a));
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -1.9e+134:
		tmp = t
	elif z <= 6.2e+57:
		tmp = x * (1.0 - (y / a))
	else:
		tmp = t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -1.9e+134)
		tmp = t;
	elseif (z <= 6.2e+57)
		tmp = Float64(x * Float64(1.0 - Float64(y / a)));
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -1.9e+134)
		tmp = t;
	elseif (z <= 6.2e+57)
		tmp = x * (1.0 - (y / a));
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.9e+134], t, If[LessEqual[z, 6.2e+57], N[(x * N[(1.0 - N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 6.2 \cdot 10^{+57}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{a}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.89999999999999999e134 or 6.20000000000000026e57 < z

    1. Initial program 60.4%

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

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

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

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

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

    if -1.89999999999999999e134 < z < 6.20000000000000026e57

    1. Initial program 90.6%

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

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

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

      \[\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 55.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 35.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -6.5 \cdot 10^{-37}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 4.6 \cdot 10^{-65}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -6.5e-37) x (if (<= a 4.6e-65) (* x (/ y z)) (+ x t))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -6.5e-37) {
		tmp = x;
	} else if (a <= 4.6e-65) {
		tmp = x * (y / z);
	} else {
		tmp = x + 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 (a <= (-6.5d-37)) then
        tmp = x
    else if (a <= 4.6d-65) then
        tmp = x * (y / z)
    else
        tmp = x + t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -6.5e-37) {
		tmp = x;
	} else if (a <= 4.6e-65) {
		tmp = x * (y / z);
	} else {
		tmp = x + t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= -6.5e-37:
		tmp = x
	elif a <= 4.6e-65:
		tmp = x * (y / z)
	else:
		tmp = x + t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -6.5e-37)
		tmp = x;
	elseif (a <= 4.6e-65)
		tmp = Float64(x * Float64(y / z));
	else
		tmp = Float64(x + t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (a <= -6.5e-37)
		tmp = x;
	elseif (a <= 4.6e-65)
		tmp = x * (y / z);
	else
		tmp = x + t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -6.5e-37], x, If[LessEqual[a, 4.6e-65], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -6.5000000000000001e-37

    1. Initial program 86.5%

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

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

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

      \[\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 45.4%

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

    if -6.5000000000000001e-37 < a < 4.5999999999999999e-65

    1. Initial program 73.5%

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

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

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

      \[\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 35.5%

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

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

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

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

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

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

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

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

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

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

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

    if 4.5999999999999999e-65 < a

    1. Initial program 86.7%

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

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

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

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

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

Alternative 15: 38.0% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4 \cdot 10^{+120}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \leq 8 \cdot 10^{+55}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -4e+120) t (if (<= z 8e+55) x t)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -4e+120) {
		tmp = t;
	} else if (z <= 8e+55) {
		tmp = x;
	} 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 <= (-4d+120)) then
        tmp = t
    else if (z <= 8d+55) then
        tmp = x
    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 <= -4e+120) {
		tmp = t;
	} else if (z <= 8e+55) {
		tmp = x;
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -4e+120:
		tmp = t
	elif z <= 8e+55:
		tmp = x
	else:
		tmp = t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -4e+120)
		tmp = t;
	elseif (z <= 8e+55)
		tmp = x;
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -4e+120)
		tmp = t;
	elseif (z <= 8e+55)
		tmp = x;
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4e+120], t, If[LessEqual[z, 8e+55], x, t]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 8 \cdot 10^{+55}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.9999999999999999e120 or 8.00000000000000008e55 < z

    1. Initial program 61.9%

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

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

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

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

    if -3.9999999999999999e120 < z < 8.00000000000000008e55

    1. Initial program 90.4%

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

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

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

      \[\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 37.6%

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

Alternative 16: 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 81.2%

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

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

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

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

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

Reproduce

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