Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 12.8s
Alternatives: 14
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 14 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. Final simplification100.0%

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

Alternative 2: 82.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := x + y \cdot \left(t - x\right)\\ \mathbf{if}\;z \leq -6.8 \cdot 10^{+121}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -5.7 \cdot 10^{+88}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -2 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-180}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-69}:\\ \;\;\;\;x - t \cdot \left(z - y\right)\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+51}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- x t))) (t_2 (+ x (* y (- t x)))))
   (if (<= z -6.8e+121)
     t_1
     (if (<= z -5.7e+88)
       t_2
       (if (<= z -2e+39)
         t_1
         (if (<= z 5.5e-180)
           t_2
           (if (<= z 2.7e-69)
             (- x (* t (- z y)))
             (if (<= z 4.2e+51) t_2 t_1))))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (x - t);
	double t_2 = x + (y * (t - x));
	double tmp;
	if (z <= -6.8e+121) {
		tmp = t_1;
	} else if (z <= -5.7e+88) {
		tmp = t_2;
	} else if (z <= -2e+39) {
		tmp = t_1;
	} else if (z <= 5.5e-180) {
		tmp = t_2;
	} else if (z <= 2.7e-69) {
		tmp = x - (t * (z - y));
	} else if (z <= 4.2e+51) {
		tmp = t_2;
	} 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) :: t_2
    real(8) :: tmp
    t_1 = z * (x - t)
    t_2 = x + (y * (t - x))
    if (z <= (-6.8d+121)) then
        tmp = t_1
    else if (z <= (-5.7d+88)) then
        tmp = t_2
    else if (z <= (-2d+39)) then
        tmp = t_1
    else if (z <= 5.5d-180) then
        tmp = t_2
    else if (z <= 2.7d-69) then
        tmp = x - (t * (z - y))
    else if (z <= 4.2d+51) then
        tmp = t_2
    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 = z * (x - t);
	double t_2 = x + (y * (t - x));
	double tmp;
	if (z <= -6.8e+121) {
		tmp = t_1;
	} else if (z <= -5.7e+88) {
		tmp = t_2;
	} else if (z <= -2e+39) {
		tmp = t_1;
	} else if (z <= 5.5e-180) {
		tmp = t_2;
	} else if (z <= 2.7e-69) {
		tmp = x - (t * (z - y));
	} else if (z <= 4.2e+51) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x - t)
	t_2 = x + (y * (t - x))
	tmp = 0
	if z <= -6.8e+121:
		tmp = t_1
	elif z <= -5.7e+88:
		tmp = t_2
	elif z <= -2e+39:
		tmp = t_1
	elif z <= 5.5e-180:
		tmp = t_2
	elif z <= 2.7e-69:
		tmp = x - (t * (z - y))
	elif z <= 4.2e+51:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(x - t))
	t_2 = Float64(x + Float64(y * Float64(t - x)))
	tmp = 0.0
	if (z <= -6.8e+121)
		tmp = t_1;
	elseif (z <= -5.7e+88)
		tmp = t_2;
	elseif (z <= -2e+39)
		tmp = t_1;
	elseif (z <= 5.5e-180)
		tmp = t_2;
	elseif (z <= 2.7e-69)
		tmp = Float64(x - Float64(t * Float64(z - y)));
	elseif (z <= 4.2e+51)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * (x - t);
	t_2 = x + (y * (t - x));
	tmp = 0.0;
	if (z <= -6.8e+121)
		tmp = t_1;
	elseif (z <= -5.7e+88)
		tmp = t_2;
	elseif (z <= -2e+39)
		tmp = t_1;
	elseif (z <= 5.5e-180)
		tmp = t_2;
	elseif (z <= 2.7e-69)
		tmp = x - (t * (z - y));
	elseif (z <= 4.2e+51)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.8e+121], t$95$1, If[LessEqual[z, -5.7e+88], t$95$2, If[LessEqual[z, -2e+39], t$95$1, If[LessEqual[z, 5.5e-180], t$95$2, If[LessEqual[z, 2.7e-69], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+51], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -5.7 \cdot 10^{+88}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -2 \cdot 10^{+39}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 5.5 \cdot 10^{-180}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 2.7 \cdot 10^{-69}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\

\mathbf{elif}\;z \leq 4.2 \cdot 10^{+51}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.80000000000000021e121 or -5.70000000000000021e88 < z < -1.99999999999999988e39 or 4.2000000000000002e51 < z

    1. Initial program 100.0%

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

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

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

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

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

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

    if -6.80000000000000021e121 < z < -5.70000000000000021e88 or -1.99999999999999988e39 < z < 5.50000000000000011e-180 or 2.6999999999999997e-69 < z < 4.2000000000000002e51

    1. Initial program 100.0%

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

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

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

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

    if 5.50000000000000011e-180 < z < 2.6999999999999997e-69

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.8 \cdot 10^{+121}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq -5.7 \cdot 10^{+88}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq -2 \cdot 10^{+39}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-180}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-69}:\\ \;\;\;\;x - t \cdot \left(z - y\right)\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+51}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 3: 35.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(-x\right)\\ t_2 := -z \cdot t\\ \mathbf{if}\;z \leq -5.6 \cdot 10^{+59}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{-259}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-179}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-44}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4 \cdot 10^{+101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+237}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (- x))) (t_2 (- (* z t))))
   (if (<= z -5.6e+59)
     t_2
     (if (<= z -1.0)
       (* z x)
       (if (<= z -1.15e-259)
         x
         (if (<= z 7.5e-179)
           t_1
           (if (<= z 9.5e-44)
             x
             (if (<= z 4e+101) t_1 (if (<= z 2.8e+237) t_2 (* z x))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * -x;
	double t_2 = -(z * t);
	double tmp;
	if (z <= -5.6e+59) {
		tmp = t_2;
	} else if (z <= -1.0) {
		tmp = z * x;
	} else if (z <= -1.15e-259) {
		tmp = x;
	} else if (z <= 7.5e-179) {
		tmp = t_1;
	} else if (z <= 9.5e-44) {
		tmp = x;
	} else if (z <= 4e+101) {
		tmp = t_1;
	} else if (z <= 2.8e+237) {
		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) :: tmp
    t_1 = y * -x
    t_2 = -(z * t)
    if (z <= (-5.6d+59)) then
        tmp = t_2
    else if (z <= (-1.0d0)) then
        tmp = z * x
    else if (z <= (-1.15d-259)) then
        tmp = x
    else if (z <= 7.5d-179) then
        tmp = t_1
    else if (z <= 9.5d-44) then
        tmp = x
    else if (z <= 4d+101) then
        tmp = t_1
    else if (z <= 2.8d+237) 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 = y * -x;
	double t_2 = -(z * t);
	double tmp;
	if (z <= -5.6e+59) {
		tmp = t_2;
	} else if (z <= -1.0) {
		tmp = z * x;
	} else if (z <= -1.15e-259) {
		tmp = x;
	} else if (z <= 7.5e-179) {
		tmp = t_1;
	} else if (z <= 9.5e-44) {
		tmp = x;
	} else if (z <= 4e+101) {
		tmp = t_1;
	} else if (z <= 2.8e+237) {
		tmp = t_2;
	} else {
		tmp = z * x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * -x
	t_2 = -(z * t)
	tmp = 0
	if z <= -5.6e+59:
		tmp = t_2
	elif z <= -1.0:
		tmp = z * x
	elif z <= -1.15e-259:
		tmp = x
	elif z <= 7.5e-179:
		tmp = t_1
	elif z <= 9.5e-44:
		tmp = x
	elif z <= 4e+101:
		tmp = t_1
	elif z <= 2.8e+237:
		tmp = t_2
	else:
		tmp = z * x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(-x))
	t_2 = Float64(-Float64(z * t))
	tmp = 0.0
	if (z <= -5.6e+59)
		tmp = t_2;
	elseif (z <= -1.0)
		tmp = Float64(z * x);
	elseif (z <= -1.15e-259)
		tmp = x;
	elseif (z <= 7.5e-179)
		tmp = t_1;
	elseif (z <= 9.5e-44)
		tmp = x;
	elseif (z <= 4e+101)
		tmp = t_1;
	elseif (z <= 2.8e+237)
		tmp = t_2;
	else
		tmp = Float64(z * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * -x;
	t_2 = -(z * t);
	tmp = 0.0;
	if (z <= -5.6e+59)
		tmp = t_2;
	elseif (z <= -1.0)
		tmp = z * x;
	elseif (z <= -1.15e-259)
		tmp = x;
	elseif (z <= 7.5e-179)
		tmp = t_1;
	elseif (z <= 9.5e-44)
		tmp = x;
	elseif (z <= 4e+101)
		tmp = t_1;
	elseif (z <= 2.8e+237)
		tmp = t_2;
	else
		tmp = z * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, Block[{t$95$2 = (-N[(z * t), $MachinePrecision])}, If[LessEqual[z, -5.6e+59], t$95$2, If[LessEqual[z, -1.0], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.15e-259], x, If[LessEqual[z, 7.5e-179], t$95$1, If[LessEqual[z, 9.5e-44], x, If[LessEqual[z, 4e+101], t$95$1, If[LessEqual[z, 2.8e+237], t$95$2, N[(z * x), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;z \leq -1.15 \cdot 10^{-259}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 7.5 \cdot 10^{-179}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 9.5 \cdot 10^{-44}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 4 \cdot 10^{+101}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 2.8 \cdot 10^{+237}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -5.5999999999999996e59 or 3.9999999999999999e101 < z < 2.79999999999999983e237

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot z\right)} \]
    6. Step-by-step derivation
      1. associate-*r*62.4%

        \[\leadsto \color{blue}{\left(-1 \cdot t\right) \cdot z} \]
      2. neg-mul-162.4%

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

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

    if -5.5999999999999996e59 < z < -1 or 2.79999999999999983e237 < z

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      3. distribute-lft-out--73.1%

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

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

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

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

    if -1 < z < -1.15e-259 or 7.4999999999999996e-179 < z < 9.49999999999999924e-44

    1. Initial program 100.0%

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

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

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

    if -1.15e-259 < z < 7.4999999999999996e-179 or 9.49999999999999924e-44 < z < 3.9999999999999999e101

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      3. distribute-lft-out--68.9%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      4. *-rgt-identity68.9%

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

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

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

        \[\leadsto \color{blue}{-x \cdot y} \]
      2. distribute-rgt-neg-in45.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.6 \cdot 10^{+59}:\\ \;\;\;\;-z \cdot t\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{-259}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-179}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-44}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4 \cdot 10^{+101}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+237}:\\ \;\;\;\;-z \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]

Alternative 4: 54.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(-x\right)\\ t_2 := z \cdot \left(x - t\right)\\ t_3 := x \cdot \left(z + 1\right)\\ \mathbf{if}\;z \leq -130000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -5.6 \cdot 10^{-260}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 4.7 \cdot 10^{-179}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-42}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 9 \cdot 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (- x))) (t_2 (* z (- x t))) (t_3 (* x (+ z 1.0))))
   (if (<= z -130000.0)
     t_2
     (if (<= z -5.6e-260)
       t_3
       (if (<= z 4.7e-179)
         t_1
         (if (<= z 3.9e-42) t_3 (if (<= z 9e+32) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * -x;
	double t_2 = z * (x - t);
	double t_3 = x * (z + 1.0);
	double tmp;
	if (z <= -130000.0) {
		tmp = t_2;
	} else if (z <= -5.6e-260) {
		tmp = t_3;
	} else if (z <= 4.7e-179) {
		tmp = t_1;
	} else if (z <= 3.9e-42) {
		tmp = t_3;
	} else if (z <= 9e+32) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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 = y * -x
    t_2 = z * (x - t)
    t_3 = x * (z + 1.0d0)
    if (z <= (-130000.0d0)) then
        tmp = t_2
    else if (z <= (-5.6d-260)) then
        tmp = t_3
    else if (z <= 4.7d-179) then
        tmp = t_1
    else if (z <= 3.9d-42) then
        tmp = t_3
    else if (z <= 9d+32) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = y * -x;
	double t_2 = z * (x - t);
	double t_3 = x * (z + 1.0);
	double tmp;
	if (z <= -130000.0) {
		tmp = t_2;
	} else if (z <= -5.6e-260) {
		tmp = t_3;
	} else if (z <= 4.7e-179) {
		tmp = t_1;
	} else if (z <= 3.9e-42) {
		tmp = t_3;
	} else if (z <= 9e+32) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * -x
	t_2 = z * (x - t)
	t_3 = x * (z + 1.0)
	tmp = 0
	if z <= -130000.0:
		tmp = t_2
	elif z <= -5.6e-260:
		tmp = t_3
	elif z <= 4.7e-179:
		tmp = t_1
	elif z <= 3.9e-42:
		tmp = t_3
	elif z <= 9e+32:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(-x))
	t_2 = Float64(z * Float64(x - t))
	t_3 = Float64(x * Float64(z + 1.0))
	tmp = 0.0
	if (z <= -130000.0)
		tmp = t_2;
	elseif (z <= -5.6e-260)
		tmp = t_3;
	elseif (z <= 4.7e-179)
		tmp = t_1;
	elseif (z <= 3.9e-42)
		tmp = t_3;
	elseif (z <= 9e+32)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * -x;
	t_2 = z * (x - t);
	t_3 = x * (z + 1.0);
	tmp = 0.0;
	if (z <= -130000.0)
		tmp = t_2;
	elseif (z <= -5.6e-260)
		tmp = t_3;
	elseif (z <= 4.7e-179)
		tmp = t_1;
	elseif (z <= 3.9e-42)
		tmp = t_3;
	elseif (z <= 9e+32)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -130000.0], t$95$2, If[LessEqual[z, -5.6e-260], t$95$3, If[LessEqual[z, 4.7e-179], t$95$1, If[LessEqual[z, 3.9e-42], t$95$3, If[LessEqual[z, 9e+32], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -5.6 \cdot 10^{-260}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 4.7 \cdot 10^{-179}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 3.9 \cdot 10^{-42}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 9 \cdot 10^{+32}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.3e5 or 9.0000000000000007e32 < z

    1. Initial program 100.0%

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

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

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

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

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

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

    if -1.3e5 < z < -5.5999999999999996e-260 or 4.7000000000000003e-179 < z < 3.9000000000000002e-42

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -5.5999999999999996e-260 < z < 4.7000000000000003e-179 or 3.9000000000000002e-42 < z < 9.0000000000000007e32

    1. Initial program 99.9%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      3. distribute-lft-out--68.6%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      4. *-rgt-identity68.6%

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

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

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

        \[\leadsto \color{blue}{-x \cdot y} \]
      2. distribute-rgt-neg-in47.3%

        \[\leadsto \color{blue}{x \cdot \left(-y\right)} \]
    7. Simplified47.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -130000:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq -5.6 \cdot 10^{-260}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;z \leq 4.7 \cdot 10^{-179}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-42}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;z \leq 9 \cdot 10^{+32}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 5: 38.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-270}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{-178}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-14}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -1.0)
   (* z x)
   (if (<= z -1.65e-270)
     x
     (if (<= z 4.1e-178) (* y t) (if (<= z 1.3e-14) x (* z x))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -1.0) {
		tmp = z * x;
	} else if (z <= -1.65e-270) {
		tmp = x;
	} else if (z <= 4.1e-178) {
		tmp = y * t;
	} else if (z <= 1.3e-14) {
		tmp = x;
	} 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) :: tmp
    if (z <= (-1.0d0)) then
        tmp = z * x
    else if (z <= (-1.65d-270)) then
        tmp = x
    else if (z <= 4.1d-178) then
        tmp = y * t
    else if (z <= 1.3d-14) then
        tmp = x
    else
        tmp = z * 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) {
		tmp = z * x;
	} else if (z <= -1.65e-270) {
		tmp = x;
	} else if (z <= 4.1e-178) {
		tmp = y * t;
	} else if (z <= 1.3e-14) {
		tmp = x;
	} else {
		tmp = z * x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -1.0:
		tmp = z * x
	elif z <= -1.65e-270:
		tmp = x
	elif z <= 4.1e-178:
		tmp = y * t
	elif z <= 1.3e-14:
		tmp = x
	else:
		tmp = z * x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -1.0)
		tmp = Float64(z * x);
	elseif (z <= -1.65e-270)
		tmp = x;
	elseif (z <= 4.1e-178)
		tmp = Float64(y * t);
	elseif (z <= 1.3e-14)
		tmp = x;
	else
		tmp = Float64(z * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -1.0)
		tmp = z * x;
	elseif (z <= -1.65e-270)
		tmp = x;
	elseif (z <= 4.1e-178)
		tmp = y * t;
	elseif (z <= 1.3e-14)
		tmp = x;
	else
		tmp = z * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.0], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.65e-270], x, If[LessEqual[z, 4.1e-178], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.3e-14], x, N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;z \leq -1.65 \cdot 10^{-270}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 4.1 \cdot 10^{-178}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 1.3 \cdot 10^{-14}:\\
\;\;\;\;x\\

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


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

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      3. distribute-lft-out--52.8%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      4. *-rgt-identity52.8%

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

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

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

    if -1 < z < -1.65000000000000009e-270 or 4.0999999999999999e-178 < z < 1.29999999999999998e-14

    1. Initial program 100.0%

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

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

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

    if -1.65000000000000009e-270 < z < 4.0999999999999999e-178

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - \left(z \cdot t - t \cdot y\right)} \]
    5. Applied egg-rr70.5%

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

      \[\leadsto \color{blue}{t \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification39.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-270}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{-178}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-14}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]

Alternative 6: 71.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -4:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-42}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 5.9 \cdot 10^{+32}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- x t))))
   (if (<= z -4.0)
     t_1
     (if (<= z 2.8e-42) (+ x (* y t)) (if (<= z 5.9e+32) (* y (- x)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (x - t);
	double tmp;
	if (z <= -4.0) {
		tmp = t_1;
	} else if (z <= 2.8e-42) {
		tmp = x + (y * t);
	} else if (z <= 5.9e+32) {
		tmp = y * -x;
	} 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 = z * (x - t)
    if (z <= (-4.0d0)) then
        tmp = t_1
    else if (z <= 2.8d-42) then
        tmp = x + (y * t)
    else if (z <= 5.9d+32) then
        tmp = y * -x
    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 = z * (x - t);
	double tmp;
	if (z <= -4.0) {
		tmp = t_1;
	} else if (z <= 2.8e-42) {
		tmp = x + (y * t);
	} else if (z <= 5.9e+32) {
		tmp = y * -x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x - t)
	tmp = 0
	if z <= -4.0:
		tmp = t_1
	elif z <= 2.8e-42:
		tmp = x + (y * t)
	elif z <= 5.9e+32:
		tmp = y * -x
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(x - t))
	tmp = 0.0
	if (z <= -4.0)
		tmp = t_1;
	elseif (z <= 2.8e-42)
		tmp = Float64(x + Float64(y * t));
	elseif (z <= 5.9e+32)
		tmp = Float64(y * Float64(-x));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * (x - t);
	tmp = 0.0;
	if (z <= -4.0)
		tmp = t_1;
	elseif (z <= 2.8e-42)
		tmp = x + (y * t);
	elseif (z <= 5.9e+32)
		tmp = y * -x;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.0], t$95$1, If[LessEqual[z, 2.8e-42], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.9e+32], N[(y * (-x)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 2.8 \cdot 10^{-42}:\\
\;\;\;\;x + y \cdot t\\

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

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


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

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    4. Simplified83.2%

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

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

    if -4 < z < 2.79999999999999998e-42

    1. Initial program 100.0%

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

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

      \[\leadsto x + \color{blue}{t \cdot y} \]
    4. Step-by-step derivation
      1. *-commutative69.0%

        \[\leadsto x + \color{blue}{y \cdot t} \]
    5. Simplified69.0%

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

    if 2.79999999999999998e-42 < z < 5.89999999999999965e32

    1. Initial program 99.8%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      3. distribute-lft-out--71.9%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      4. *-rgt-identity71.9%

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

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

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

        \[\leadsto \color{blue}{-x \cdot y} \]
      2. distribute-rgt-neg-in59.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-42}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 5.9 \cdot 10^{+32}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 7: 76.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+36} \lor \neg \left(z \leq 4.3 \cdot 10^{+52}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\

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


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

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    4. Simplified86.2%

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

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

    if -6e36 < z < 4.3e52

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{+36} \lor \neg \left(z \leq 4.3 \cdot 10^{+52}\right):\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;x - t \cdot \left(z - y\right)\\ \end{array} \]

Alternative 8: 80.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.5 \cdot 10^{-46} \lor \neg \left(t \leq 2 \cdot 10^{+74}\right):\\
\;\;\;\;x - t \cdot \left(z - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -6.49999999999999966e-46 or 1.9999999999999999e74 < t

    1. Initial program 100.0%

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

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

    if -6.49999999999999966e-46 < t < 1.9999999999999999e74

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      3. distribute-lft-out--80.9%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      4. *-rgt-identity80.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.5 \cdot 10^{-46} \lor \neg \left(t \leq 2 \cdot 10^{+74}\right):\\ \;\;\;\;x - t \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot \left(z - y\right)\\ \end{array} \]

Alternative 9: 80.1% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.85 \cdot 10^{-45} \lor \neg \left(t \leq 3.35 \cdot 10^{+75}\right):\\
\;\;\;\;x - t \cdot \left(z - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.85e-45 or 3.35e75 < t

    1. Initial program 100.0%

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

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

    if -1.85e-45 < t < 3.35e75

    1. Initial program 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.85 \cdot 10^{-45} \lor \neg \left(t \leq 3.35 \cdot 10^{+75}\right):\\ \;\;\;\;x - t \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\left(z + 1\right) - y\right)\\ \end{array} \]

Alternative 10: 37.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(-x\right)\\ \mathbf{if}\;y \leq -1950000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{-45}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{+111}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (- x))))
   (if (<= y -1950000.0)
     t_1
     (if (<= y 6.5e-45) x (if (<= y 4.7e+111) (* y t) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = y * -x;
	double tmp;
	if (y <= -1950000.0) {
		tmp = t_1;
	} else if (y <= 6.5e-45) {
		tmp = x;
	} else if (y <= 4.7e+111) {
		tmp = y * 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 = y * -x
    if (y <= (-1950000.0d0)) then
        tmp = t_1
    else if (y <= 6.5d-45) then
        tmp = x
    else if (y <= 4.7d+111) then
        tmp = y * 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 = y * -x;
	double tmp;
	if (y <= -1950000.0) {
		tmp = t_1;
	} else if (y <= 6.5e-45) {
		tmp = x;
	} else if (y <= 4.7e+111) {
		tmp = y * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * -x
	tmp = 0
	if y <= -1950000.0:
		tmp = t_1
	elif y <= 6.5e-45:
		tmp = x
	elif y <= 4.7e+111:
		tmp = y * t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(-x))
	tmp = 0.0
	if (y <= -1950000.0)
		tmp = t_1;
	elseif (y <= 6.5e-45)
		tmp = x;
	elseif (y <= 4.7e+111)
		tmp = Float64(y * t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * -x;
	tmp = 0.0;
	if (y <= -1950000.0)
		tmp = t_1;
	elseif (y <= 6.5e-45)
		tmp = x;
	elseif (y <= 4.7e+111)
		tmp = y * t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, If[LessEqual[y, -1950000.0], t$95$1, If[LessEqual[y, 6.5e-45], x, If[LessEqual[y, 4.7e+111], N[(y * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
\mathbf{if}\;y \leq -1950000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 6.5 \cdot 10^{-45}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 4.7 \cdot 10^{+111}:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.95e6 or 4.70000000000000008e111 < y

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      3. distribute-lft-out--60.2%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      4. *-rgt-identity60.2%

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

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

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

        \[\leadsto \color{blue}{-x \cdot y} \]
      2. distribute-rgt-neg-in53.2%

        \[\leadsto \color{blue}{x \cdot \left(-y\right)} \]
    7. Simplified53.2%

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

    if -1.95e6 < y < 6.4999999999999995e-45

    1. Initial program 100.0%

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

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

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

    if 6.4999999999999995e-45 < y < 4.70000000000000008e111

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \left(x + \color{blue}{\left(-t \cdot z\right)}\right) + t \cdot y \]
      3. *-commutative62.4%

        \[\leadsto \left(x + \left(-\color{blue}{z \cdot t}\right)\right) + t \cdot y \]
      4. sub-neg62.4%

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

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

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

      \[\leadsto \color{blue}{t \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification42.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1950000:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{-45}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{+111}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \]

Alternative 11: 49.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+41} \lor \neg \left(y \leq 9.5 \cdot 10^{+30}\right):\\
\;\;\;\;y \cdot \left(-x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.2e41 or 9.5000000000000003e30 < y

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      3. distribute-lft-out--56.4%

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

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

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

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

        \[\leadsto \color{blue}{-x \cdot y} \]
      2. distribute-rgt-neg-in51.6%

        \[\leadsto \color{blue}{x \cdot \left(-y\right)} \]
    7. Simplified51.6%

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

    if -6.2e41 < y < 9.5000000000000003e30

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{+41} \lor \neg \left(y \leq 9.5 \cdot 10^{+30}\right):\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \end{array} \]

Alternative 12: 100.0% accurate, 1.0× speedup?

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

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

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

    \[\leadsto x + \left(x - t\right) \cdot \left(z - y\right) \]

Alternative 13: 38.0% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{-23}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;y \leq 9 \cdot 10^{-45}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.3e-23 or 8.9999999999999997e-45 < y

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \left(x + \color{blue}{\left(-t \cdot z\right)}\right) + t \cdot y \]
      3. *-commutative48.4%

        \[\leadsto \left(x + \left(-\color{blue}{z \cdot t}\right)\right) + t \cdot y \]
      4. sub-neg48.4%

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

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

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

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

    if -1.3e-23 < y < 8.9999999999999997e-45

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{-23}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-45}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]

Alternative 14: 18.1% 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. Taylor expanded in t around inf 65.4%

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

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

    \[\leadsto x \]

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 2023287 
(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))))