Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 8.7s
Alternatives: 12
Speedup: 1.0×

Specification

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

\\
x + \left(y - z\right) \cdot \left(t - x\right)
\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 12 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: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(y - z, t - x, x\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
	return fma((y - z), (t - x), x);
}
function code(x, y, z, t)
	return fma(Float64(y - z), Float64(t - x), x)
end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[x + \left(y - z\right) \cdot \left(t - x\right) \]
  2. Step-by-step derivation
    1. +-commutative100.0%

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t - x, x\right)} \]
  4. Add Preprocessing
  5. Final simplification100.0%

    \[\leadsto \mathsf{fma}\left(y - z, t - x, x\right) \]
  6. Add Preprocessing

Alternative 2: 51.6% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(1 - y\right)\\ t_2 := z \cdot \left(-t\right)\\ t_3 := x + y \cdot t\\ \mathbf{if}\;z \leq -1.6 \cdot 10^{+146}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -7.4 \cdot 10^{-71}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-274}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{-138}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-12}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 118:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+154}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- 1.0 y))) (t_2 (* z (- t))) (t_3 (+ x (* y t))))
   (if (<= z -1.6e+146)
     t_2
     (if (<= z -7.4e-71)
       t_3
       (if (<= z -6.2e-274)
         t_1
         (if (<= z 7.6e-138)
           t_3
           (if (<= z 5.5e-12)
             t_1
             (if (<= z 118.0) t_3 (if (<= z 5.2e+154) t_2 (* z x))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - y);
	double t_2 = z * -t;
	double t_3 = x + (y * t);
	double tmp;
	if (z <= -1.6e+146) {
		tmp = t_2;
	} else if (z <= -7.4e-71) {
		tmp = t_3;
	} else if (z <= -6.2e-274) {
		tmp = t_1;
	} else if (z <= 7.6e-138) {
		tmp = t_3;
	} else if (z <= 5.5e-12) {
		tmp = t_1;
	} else if (z <= 118.0) {
		tmp = t_3;
	} else if (z <= 5.2e+154) {
		tmp = t_2;
	} else {
		tmp = z * x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = x * (1.0d0 - y)
    t_2 = z * -t
    t_3 = x + (y * t)
    if (z <= (-1.6d+146)) then
        tmp = t_2
    else if (z <= (-7.4d-71)) then
        tmp = t_3
    else if (z <= (-6.2d-274)) then
        tmp = t_1
    else if (z <= 7.6d-138) then
        tmp = t_3
    else if (z <= 5.5d-12) then
        tmp = t_1
    else if (z <= 118.0d0) then
        tmp = t_3
    else if (z <= 5.2d+154) then
        tmp = t_2
    else
        tmp = z * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - y);
	double t_2 = z * -t;
	double t_3 = x + (y * t);
	double tmp;
	if (z <= -1.6e+146) {
		tmp = t_2;
	} else if (z <= -7.4e-71) {
		tmp = t_3;
	} else if (z <= -6.2e-274) {
		tmp = t_1;
	} else if (z <= 7.6e-138) {
		tmp = t_3;
	} else if (z <= 5.5e-12) {
		tmp = t_1;
	} else if (z <= 118.0) {
		tmp = t_3;
	} else if (z <= 5.2e+154) {
		tmp = t_2;
	} else {
		tmp = z * x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (1.0 - y)
	t_2 = z * -t
	t_3 = x + (y * t)
	tmp = 0
	if z <= -1.6e+146:
		tmp = t_2
	elif z <= -7.4e-71:
		tmp = t_3
	elif z <= -6.2e-274:
		tmp = t_1
	elif z <= 7.6e-138:
		tmp = t_3
	elif z <= 5.5e-12:
		tmp = t_1
	elif z <= 118.0:
		tmp = t_3
	elif z <= 5.2e+154:
		tmp = t_2
	else:
		tmp = z * x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(1.0 - y))
	t_2 = Float64(z * Float64(-t))
	t_3 = Float64(x + Float64(y * t))
	tmp = 0.0
	if (z <= -1.6e+146)
		tmp = t_2;
	elseif (z <= -7.4e-71)
		tmp = t_3;
	elseif (z <= -6.2e-274)
		tmp = t_1;
	elseif (z <= 7.6e-138)
		tmp = t_3;
	elseif (z <= 5.5e-12)
		tmp = t_1;
	elseif (z <= 118.0)
		tmp = t_3;
	elseif (z <= 5.2e+154)
		tmp = t_2;
	else
		tmp = Float64(z * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (1.0 - y);
	t_2 = z * -t;
	t_3 = x + (y * t);
	tmp = 0.0;
	if (z <= -1.6e+146)
		tmp = t_2;
	elseif (z <= -7.4e-71)
		tmp = t_3;
	elseif (z <= -6.2e-274)
		tmp = t_1;
	elseif (z <= 7.6e-138)
		tmp = t_3;
	elseif (z <= 5.5e-12)
		tmp = t_1;
	elseif (z <= 118.0)
		tmp = t_3;
	elseif (z <= 5.2e+154)
		tmp = t_2;
	else
		tmp = z * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * (-t)), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.6e+146], t$95$2, If[LessEqual[z, -7.4e-71], t$95$3, If[LessEqual[z, -6.2e-274], t$95$1, If[LessEqual[z, 7.6e-138], t$95$3, If[LessEqual[z, 5.5e-12], t$95$1, If[LessEqual[z, 118.0], t$95$3, If[LessEqual[z, 5.2e+154], t$95$2, N[(z * x), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(1 - y\right)\\
t_2 := z \cdot \left(-t\right)\\
t_3 := x + y \cdot t\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+146}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -7.4 \cdot 10^{-71}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq -6.2 \cdot 10^{-274}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 7.6 \cdot 10^{-138}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 5.5 \cdot 10^{-12}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 118:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 5.2 \cdot 10^{+154}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.6e146 or 118 < z < 5.19999999999999978e154

    1. Initial program 99.9%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. unsub-neg81.3%

        \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    5. Simplified81.3%

      \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    6. Taylor expanded in t around inf 56.8%

      \[\leadsto x - \color{blue}{t \cdot z} \]
    7. Taylor expanded in x around 0 56.2%

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot z\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg56.2%

        \[\leadsto \color{blue}{-t \cdot z} \]
      2. distribute-rgt-neg-out56.2%

        \[\leadsto \color{blue}{t \cdot \left(-z\right)} \]
    9. Simplified56.2%

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

    if -1.6e146 < z < -7.3999999999999993e-71 or -6.19999999999999956e-274 < z < 7.6000000000000005e-138 or 5.5000000000000004e-12 < z < 118

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\left(t + \left(-x\right)\right)} \]
      2. distribute-lft-in96.8%

        \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot t + \left(y - z\right) \cdot \left(-x\right)\right)} \]
    4. Applied egg-rr96.8%

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

      \[\leadsto x + \color{blue}{\left(-1 \cdot \left(x \cdot y\right) + t \cdot y\right)} \]
    6. Taylor expanded in x around 0 69.5%

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

    if -7.3999999999999993e-71 < z < -6.19999999999999956e-274 or 7.6000000000000005e-138 < z < 5.5000000000000004e-12

    1. Initial program 100.0%

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      2. unsub-neg74.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
    5. Simplified74.0%

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

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

    if 5.19999999999999978e154 < z

    1. Initial program 99.9%

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(z + 1\right)} \]
    8. Simplified54.6%

      \[\leadsto \color{blue}{x \cdot \left(z + 1\right)} \]
    9. Taylor expanded in z around inf 54.6%

      \[\leadsto \color{blue}{x \cdot z} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification65.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{+146}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq -7.4 \cdot 10^{-71}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-274}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{-138}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-12}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 118:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+154}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 38.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(-t\right)\\ \mathbf{if}\;z \leq -4 \cdot 10^{+137}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{+30}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-62}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 960:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 5.3 \cdot 10^{+157}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- t))))
   (if (<= z -4e+137)
     t_1
     (if (<= z -6.2e+30)
       (* z x)
       (if (<= z -6.2e-62)
         t_1
         (if (<= z 960.0) x (if (<= z 5.3e+157) t_1 (* z x))))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * -t;
	double tmp;
	if (z <= -4e+137) {
		tmp = t_1;
	} else if (z <= -6.2e+30) {
		tmp = z * x;
	} else if (z <= -6.2e-62) {
		tmp = t_1;
	} else if (z <= 960.0) {
		tmp = x;
	} else if (z <= 5.3e+157) {
		tmp = t_1;
	} else {
		tmp = z * x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = z * -t
    if (z <= (-4d+137)) then
        tmp = t_1
    else if (z <= (-6.2d+30)) then
        tmp = z * x
    else if (z <= (-6.2d-62)) then
        tmp = t_1
    else if (z <= 960.0d0) then
        tmp = x
    else if (z <= 5.3d+157) then
        tmp = t_1
    else
        tmp = z * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = z * -t;
	double tmp;
	if (z <= -4e+137) {
		tmp = t_1;
	} else if (z <= -6.2e+30) {
		tmp = z * x;
	} else if (z <= -6.2e-62) {
		tmp = t_1;
	} else if (z <= 960.0) {
		tmp = x;
	} else if (z <= 5.3e+157) {
		tmp = t_1;
	} else {
		tmp = z * x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * -t
	tmp = 0
	if z <= -4e+137:
		tmp = t_1
	elif z <= -6.2e+30:
		tmp = z * x
	elif z <= -6.2e-62:
		tmp = t_1
	elif z <= 960.0:
		tmp = x
	elif z <= 5.3e+157:
		tmp = t_1
	else:
		tmp = z * x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(-t))
	tmp = 0.0
	if (z <= -4e+137)
		tmp = t_1;
	elseif (z <= -6.2e+30)
		tmp = Float64(z * x);
	elseif (z <= -6.2e-62)
		tmp = t_1;
	elseif (z <= 960.0)
		tmp = x;
	elseif (z <= 5.3e+157)
		tmp = t_1;
	else
		tmp = Float64(z * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * -t;
	tmp = 0.0;
	if (z <= -4e+137)
		tmp = t_1;
	elseif (z <= -6.2e+30)
		tmp = z * x;
	elseif (z <= -6.2e-62)
		tmp = t_1;
	elseif (z <= 960.0)
		tmp = x;
	elseif (z <= 5.3e+157)
		tmp = t_1;
	else
		tmp = z * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -4e+137], t$95$1, If[LessEqual[z, -6.2e+30], N[(z * x), $MachinePrecision], If[LessEqual[z, -6.2e-62], t$95$1, If[LessEqual[z, 960.0], x, If[LessEqual[z, 5.3e+157], t$95$1, N[(z * x), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -4 \cdot 10^{+137}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -6.2 \cdot 10^{+30}:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;z \leq -6.2 \cdot 10^{-62}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 960:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 5.3 \cdot 10^{+157}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.0000000000000001e137 or -6.1999999999999995e30 < z < -6.1999999999999999e-62 or 960 < z < 5.2999999999999998e157

    1. Initial program 99.9%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. unsub-neg78.8%

        \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    5. Simplified78.8%

      \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    6. Taylor expanded in t around inf 55.9%

      \[\leadsto x - \color{blue}{t \cdot z} \]
    7. Taylor expanded in x around 0 53.4%

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot z\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg53.4%

        \[\leadsto \color{blue}{-t \cdot z} \]
      2. distribute-rgt-neg-out53.4%

        \[\leadsto \color{blue}{t \cdot \left(-z\right)} \]
    9. Simplified53.4%

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

    if -4.0000000000000001e137 < z < -6.1999999999999995e30 or 5.2999999999999998e157 < z

    1. Initial program 100.0%

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      2. unsub-neg61.9%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
    5. Simplified61.9%

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

      \[\leadsto \color{blue}{x \cdot \left(1 + z\right)} \]
    7. Step-by-step derivation
      1. +-commutative52.3%

        \[\leadsto x \cdot \color{blue}{\left(z + 1\right)} \]
    8. Simplified52.3%

      \[\leadsto \color{blue}{x \cdot \left(z + 1\right)} \]
    9. Taylor expanded in z around inf 52.3%

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

    if -6.1999999999999999e-62 < z < 960

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. unsub-neg37.6%

        \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    5. Simplified37.6%

      \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    6. Taylor expanded in z around 0 33.2%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification42.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4 \cdot 10^{+137}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{+30}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-62}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 960:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 5.3 \cdot 10^{+157}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 50.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(-t\right)\\ \mathbf{if}\;z \leq -8 \cdot 10^{+145}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.85 \cdot 10^{+31}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -14.2:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 26000:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+165}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- t))))
   (if (<= z -8e+145)
     t_1
     (if (<= z -1.85e+31)
       (* z x)
       (if (<= z -14.2)
         t_1
         (if (<= z 26000.0)
           (* x (- 1.0 y))
           (if (<= z 4.2e+165) t_1 (* z x))))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * -t;
	double tmp;
	if (z <= -8e+145) {
		tmp = t_1;
	} else if (z <= -1.85e+31) {
		tmp = z * x;
	} else if (z <= -14.2) {
		tmp = t_1;
	} else if (z <= 26000.0) {
		tmp = x * (1.0 - y);
	} else if (z <= 4.2e+165) {
		tmp = t_1;
	} else {
		tmp = z * x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = z * -t
    if (z <= (-8d+145)) then
        tmp = t_1
    else if (z <= (-1.85d+31)) then
        tmp = z * x
    else if (z <= (-14.2d0)) then
        tmp = t_1
    else if (z <= 26000.0d0) then
        tmp = x * (1.0d0 - y)
    else if (z <= 4.2d+165) then
        tmp = t_1
    else
        tmp = z * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = z * -t;
	double tmp;
	if (z <= -8e+145) {
		tmp = t_1;
	} else if (z <= -1.85e+31) {
		tmp = z * x;
	} else if (z <= -14.2) {
		tmp = t_1;
	} else if (z <= 26000.0) {
		tmp = x * (1.0 - y);
	} else if (z <= 4.2e+165) {
		tmp = t_1;
	} else {
		tmp = z * x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * -t
	tmp = 0
	if z <= -8e+145:
		tmp = t_1
	elif z <= -1.85e+31:
		tmp = z * x
	elif z <= -14.2:
		tmp = t_1
	elif z <= 26000.0:
		tmp = x * (1.0 - y)
	elif z <= 4.2e+165:
		tmp = t_1
	else:
		tmp = z * x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(-t))
	tmp = 0.0
	if (z <= -8e+145)
		tmp = t_1;
	elseif (z <= -1.85e+31)
		tmp = Float64(z * x);
	elseif (z <= -14.2)
		tmp = t_1;
	elseif (z <= 26000.0)
		tmp = Float64(x * Float64(1.0 - y));
	elseif (z <= 4.2e+165)
		tmp = t_1;
	else
		tmp = Float64(z * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * -t;
	tmp = 0.0;
	if (z <= -8e+145)
		tmp = t_1;
	elseif (z <= -1.85e+31)
		tmp = z * x;
	elseif (z <= -14.2)
		tmp = t_1;
	elseif (z <= 26000.0)
		tmp = x * (1.0 - y);
	elseif (z <= 4.2e+165)
		tmp = t_1;
	else
		tmp = z * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -8e+145], t$95$1, If[LessEqual[z, -1.85e+31], N[(z * x), $MachinePrecision], If[LessEqual[z, -14.2], t$95$1, If[LessEqual[z, 26000.0], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+165], t$95$1, N[(z * x), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -8 \cdot 10^{+145}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -1.85 \cdot 10^{+31}:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;z \leq -14.2:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 26000:\\
\;\;\;\;x \cdot \left(1 - y\right)\\

\mathbf{elif}\;z \leq 4.2 \cdot 10^{+165}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -7.9999999999999999e145 or -1.8499999999999999e31 < z < -14.199999999999999 or 26000 < z < 4.2000000000000001e165

    1. Initial program 99.9%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. unsub-neg81.6%

        \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    5. Simplified81.6%

      \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    6. Taylor expanded in t around inf 56.4%

      \[\leadsto x - \color{blue}{t \cdot z} \]
    7. Taylor expanded in x around 0 55.9%

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot z\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg55.9%

        \[\leadsto \color{blue}{-t \cdot z} \]
      2. distribute-rgt-neg-out55.9%

        \[\leadsto \color{blue}{t \cdot \left(-z\right)} \]
    9. Simplified55.9%

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

    if -7.9999999999999999e145 < z < -1.8499999999999999e31 or 4.2000000000000001e165 < z

    1. Initial program 100.0%

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      2. unsub-neg61.9%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
    5. Simplified61.9%

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

      \[\leadsto \color{blue}{x \cdot \left(1 + z\right)} \]
    7. Step-by-step derivation
      1. +-commutative52.3%

        \[\leadsto x \cdot \color{blue}{\left(z + 1\right)} \]
    8. Simplified52.3%

      \[\leadsto \color{blue}{x \cdot \left(z + 1\right)} \]
    9. Taylor expanded in z around inf 52.3%

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

    if -14.199999999999999 < z < 26000

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
    5. Simplified63.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8 \cdot 10^{+145}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq -1.85 \cdot 10^{+31}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -14.2:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 26000:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+165}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 72.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -3.3 \cdot 10^{+18}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.05 \cdot 10^{-51}:\\ \;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-88}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* y (- t x)))))
   (if (<= y -3.3e+18)
     t_1
     (if (<= y -1.05e-51)
       (* x (+ (- z y) 1.0))
       (if (<= y 3.2e-88) (- x (* z t)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x + (y * (t - x));
	double tmp;
	if (y <= -3.3e+18) {
		tmp = t_1;
	} else if (y <= -1.05e-51) {
		tmp = x * ((z - y) + 1.0);
	} else if (y <= 3.2e-88) {
		tmp = x - (z * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + (y * (t - x))
    if (y <= (-3.3d+18)) then
        tmp = t_1
    else if (y <= (-1.05d-51)) then
        tmp = x * ((z - y) + 1.0d0)
    else if (y <= 3.2d-88) then
        tmp = x - (z * t)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x + (y * (t - x));
	double tmp;
	if (y <= -3.3e+18) {
		tmp = t_1;
	} else if (y <= -1.05e-51) {
		tmp = x * ((z - y) + 1.0);
	} else if (y <= 3.2e-88) {
		tmp = x - (z * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + (y * (t - x))
	tmp = 0
	if y <= -3.3e+18:
		tmp = t_1
	elif y <= -1.05e-51:
		tmp = x * ((z - y) + 1.0)
	elif y <= 3.2e-88:
		tmp = x - (z * t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(y * Float64(t - x)))
	tmp = 0.0
	if (y <= -3.3e+18)
		tmp = t_1;
	elseif (y <= -1.05e-51)
		tmp = Float64(x * Float64(Float64(z - y) + 1.0));
	elseif (y <= 3.2e-88)
		tmp = Float64(x - Float64(z * t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + (y * (t - x));
	tmp = 0.0;
	if (y <= -3.3e+18)
		tmp = t_1;
	elseif (y <= -1.05e-51)
		tmp = x * ((z - y) + 1.0);
	elseif (y <= 3.2e-88)
		tmp = x - (z * t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.3e+18], t$95$1, If[LessEqual[y, -1.05e-51], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e-88], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -3.3 \cdot 10^{+18}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.05 \cdot 10^{-51}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\

\mathbf{elif}\;y \leq 3.2 \cdot 10^{-88}:\\
\;\;\;\;x - z \cdot t\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.3e18 or 3.20000000000000012e-88 < y

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(t - x\right) \cdot y} \]
    5. Simplified78.5%

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

    if -3.3e18 < y < -1.05000000000000001e-51

    1. Initial program 99.9%

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      2. unsub-neg77.6%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
    5. Simplified77.6%

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

    if -1.05000000000000001e-51 < y < 3.20000000000000012e-88

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. unsub-neg91.9%

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

      \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    6. Taylor expanded in t around inf 76.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.3 \cdot 10^{+18}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -1.05 \cdot 10^{-51}:\\ \;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-88}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 54.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(1 - y\right)\\ \mathbf{if}\;y \leq -9 \cdot 10^{+87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.7 \cdot 10^{-20}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;y \leq 3600000:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- 1.0 y))))
   (if (<= y -9e+87)
     t_1
     (if (<= y -3.7e-20)
       (+ x (* y t))
       (if (<= y 3600000.0) (- x (* z t)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - y);
	double tmp;
	if (y <= -9e+87) {
		tmp = t_1;
	} else if (y <= -3.7e-20) {
		tmp = x + (y * t);
	} else if (y <= 3600000.0) {
		tmp = x - (z * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * (1.0d0 - y)
    if (y <= (-9d+87)) then
        tmp = t_1
    else if (y <= (-3.7d-20)) then
        tmp = x + (y * t)
    else if (y <= 3600000.0d0) then
        tmp = x - (z * t)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - y);
	double tmp;
	if (y <= -9e+87) {
		tmp = t_1;
	} else if (y <= -3.7e-20) {
		tmp = x + (y * t);
	} else if (y <= 3600000.0) {
		tmp = x - (z * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (1.0 - y)
	tmp = 0
	if y <= -9e+87:
		tmp = t_1
	elif y <= -3.7e-20:
		tmp = x + (y * t)
	elif y <= 3600000.0:
		tmp = x - (z * t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(1.0 - y))
	tmp = 0.0
	if (y <= -9e+87)
		tmp = t_1;
	elseif (y <= -3.7e-20)
		tmp = Float64(x + Float64(y * t));
	elseif (y <= 3600000.0)
		tmp = Float64(x - Float64(z * t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (1.0 - y);
	tmp = 0.0;
	if (y <= -9e+87)
		tmp = t_1;
	elseif (y <= -3.7e-20)
		tmp = x + (y * t);
	elseif (y <= 3600000.0)
		tmp = x - (z * t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9e+87], t$95$1, If[LessEqual[y, -3.7e-20], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3600000.0], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(1 - y\right)\\
\mathbf{if}\;y \leq -9 \cdot 10^{+87}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -3.7 \cdot 10^{-20}:\\
\;\;\;\;x + y \cdot t\\

\mathbf{elif}\;y \leq 3600000:\\
\;\;\;\;x - z \cdot t\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.0000000000000005e87 or 3.6e6 < y

    1. Initial program 100.0%

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      2. unsub-neg57.7%

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

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

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

    if -9.0000000000000005e87 < y < -3.7000000000000001e-20

    1. Initial program 99.9%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg99.9%

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

        \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot t + \left(y - z\right) \cdot \left(-x\right)\right)} \]
    4. Applied egg-rr93.2%

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

      \[\leadsto x + \color{blue}{\left(-1 \cdot \left(x \cdot y\right) + t \cdot y\right)} \]
    6. Taylor expanded in x around 0 58.7%

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

    if -3.7000000000000001e-20 < y < 3.6e6

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. unsub-neg88.9%

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

      \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    6. Taylor expanded in t around inf 69.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+87}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;y \leq -3.7 \cdot 10^{-20}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;y \leq 3600000:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 84.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2000 \lor \neg \left(z \leq 10800\right):\\
\;\;\;\;x - z \cdot \left(t - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2e3 or 10800 < z

    1. Initial program 99.9%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. unsub-neg79.8%

        \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    5. Simplified79.8%

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

    if -2e3 < z < 10800

    1. Initial program 100.0%

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

      \[\leadsto x + \color{blue}{y \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. *-commutative94.7%

        \[\leadsto x + \color{blue}{\left(t - x\right) \cdot y} \]
    5. Simplified94.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2000 \lor \neg \left(z \leq 10800\right):\\ \;\;\;\;x - z \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 64.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.04 \cdot 10^{+26}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;t \leq 5.6 \cdot 10^{+34}:\\ \;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -1.04e+26)
   (- x (* z t))
   (if (<= t 5.6e+34) (* x (+ (- z y) 1.0)) (+ x (* y t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.04e+26) {
		tmp = x - (z * t);
	} else if (t <= 5.6e+34) {
		tmp = x * ((z - y) + 1.0);
	} else {
		tmp = x + (y * t);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-1.04d+26)) then
        tmp = x - (z * t)
    else if (t <= 5.6d+34) then
        tmp = x * ((z - y) + 1.0d0)
    else
        tmp = x + (y * t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.04e+26) {
		tmp = x - (z * t);
	} else if (t <= 5.6e+34) {
		tmp = x * ((z - y) + 1.0);
	} else {
		tmp = x + (y * t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -1.04e+26:
		tmp = x - (z * t)
	elif t <= 5.6e+34:
		tmp = x * ((z - y) + 1.0)
	else:
		tmp = x + (y * t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -1.04e+26)
		tmp = Float64(x - Float64(z * t));
	elseif (t <= 5.6e+34)
		tmp = Float64(x * Float64(Float64(z - y) + 1.0));
	else
		tmp = Float64(x + Float64(y * t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -1.04e+26)
		tmp = x - (z * t);
	elseif (t <= 5.6e+34)
		tmp = x * ((z - y) + 1.0);
	else
		tmp = x + (y * t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.04e+26], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.6e+34], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.04 \cdot 10^{+26}:\\
\;\;\;\;x - z \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.0399999999999999e26

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. unsub-neg61.3%

        \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    5. Simplified61.3%

      \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    6. Taylor expanded in t around inf 58.2%

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

    if -1.0399999999999999e26 < t < 5.60000000000000016e34

    1. Initial program 99.9%

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      2. unsub-neg81.6%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
    5. Simplified81.6%

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

    if 5.60000000000000016e34 < t

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot t + \left(y - z\right) \cdot \left(-x\right)\right)} \]
    4. Applied egg-rr89.2%

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

      \[\leadsto x + \color{blue}{\left(-1 \cdot \left(x \cdot y\right) + t \cdot y\right)} \]
    6. Taylor expanded in x around 0 56.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.04 \cdot 10^{+26}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;t \leq 5.6 \cdot 10^{+34}:\\ \;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 46.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+18} \lor \neg \left(t \leq 6 \cdot 10^{+50}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1e18 or 5.9999999999999996e50 < t

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. unsub-neg54.6%

        \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    5. Simplified54.6%

      \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    6. Taylor expanded in t around inf 50.7%

      \[\leadsto x - \color{blue}{t \cdot z} \]
    7. Taylor expanded in x around 0 44.3%

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot z\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg44.3%

        \[\leadsto \color{blue}{-t \cdot z} \]
      2. distribute-rgt-neg-out44.3%

        \[\leadsto \color{blue}{t \cdot \left(-z\right)} \]
    9. Simplified44.3%

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

    if -1e18 < t < 5.9999999999999996e50

    1. Initial program 99.9%

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      2. unsub-neg79.4%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
    5. Simplified79.4%

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

      \[\leadsto \color{blue}{x \cdot \left(1 + z\right)} \]
    7. Step-by-step derivation
      1. +-commutative52.4%

        \[\leadsto x \cdot \color{blue}{\left(z + 1\right)} \]
    8. Simplified52.4%

      \[\leadsto \color{blue}{x \cdot \left(z + 1\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1 \cdot 10^{+18} \lor \neg \left(t \leq 6 \cdot 10^{+50}\right):\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 38.0% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;z \cdot x\\

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


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

    1. Initial program 99.9%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
    5. Simplified47.2%

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

      \[\leadsto \color{blue}{x \cdot \left(1 + z\right)} \]
    7. Step-by-step derivation
      1. +-commutative36.7%

        \[\leadsto x \cdot \color{blue}{\left(z + 1\right)} \]
    8. Simplified36.7%

      \[\leadsto \color{blue}{x \cdot \left(z + 1\right)} \]
    9. Taylor expanded in z around inf 36.0%

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

    if -1 < z < 1

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. unsub-neg38.6%

        \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    5. Simplified38.6%

      \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    6. Taylor expanded in z around 0 33.1%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification34.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 100.0% accurate, 1.0× speedup?

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

\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[x + \left(y - z\right) \cdot \left(t - x\right) \]
  2. Add Preprocessing
  3. Final simplification100.0%

    \[\leadsto x + \left(y - z\right) \cdot \left(t - x\right) \]
  4. Add Preprocessing

Alternative 12: 18.0% accurate, 9.0× speedup?

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

\\
x
\end{array}
Derivation
  1. Initial program 100.0%

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

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

      \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
    2. unsub-neg57.1%

      \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
  5. Simplified57.1%

    \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
  6. Taylor expanded in z around 0 19.4%

    \[\leadsto \color{blue}{x} \]
  7. Final simplification19.4%

    \[\leadsto x \]
  8. Add Preprocessing

Developer target: 96.4% accurate, 0.6× speedup?

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

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

Reproduce

?
herbie shell --seed 2024024 
(FPCore (x y z t)
  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
  :precision binary64

  :herbie-target
  (+ x (+ (* t (- y z)) (* (- x) (- y z))))

  (+ x (* (- y z) (- t x))))