Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 8.5s
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, 1.0× speedup?

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

\\
x + \left(t - x\right) \cdot \left(y - z\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(t - x\right) \cdot \left(y - z\right) \]

Alternative 2: 51.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(1 - y\right)\\ t_2 := x + x \cdot z\\ t_3 := x + y \cdot t\\ \mathbf{if}\;z \leq -8000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -4.7 \cdot 10^{-228}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-129}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-61}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+72}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{+278}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- 1.0 y))) (t_2 (+ x (* x z))) (t_3 (+ x (* y t))))
   (if (<= z -8000000.0)
     t_2
     (if (<= z -4.7e-228)
       t_3
       (if (<= z 4.4e-129)
         t_1
         (if (<= z 4e-61)
           t_3
           (if (<= z 1.1e+72) t_1 (if (<= z 2.65e+278) (* t (- z)) t_2))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - y);
	double t_2 = x + (x * z);
	double t_3 = x + (y * t);
	double tmp;
	if (z <= -8000000.0) {
		tmp = t_2;
	} else if (z <= -4.7e-228) {
		tmp = t_3;
	} else if (z <= 4.4e-129) {
		tmp = t_1;
	} else if (z <= 4e-61) {
		tmp = t_3;
	} else if (z <= 1.1e+72) {
		tmp = t_1;
	} else if (z <= 2.65e+278) {
		tmp = t * -z;
	} 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 = x * (1.0d0 - y)
    t_2 = x + (x * z)
    t_3 = x + (y * t)
    if (z <= (-8000000.0d0)) then
        tmp = t_2
    else if (z <= (-4.7d-228)) then
        tmp = t_3
    else if (z <= 4.4d-129) then
        tmp = t_1
    else if (z <= 4d-61) then
        tmp = t_3
    else if (z <= 1.1d+72) then
        tmp = t_1
    else if (z <= 2.65d+278) then
        tmp = t * -z
    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 = x * (1.0 - y);
	double t_2 = x + (x * z);
	double t_3 = x + (y * t);
	double tmp;
	if (z <= -8000000.0) {
		tmp = t_2;
	} else if (z <= -4.7e-228) {
		tmp = t_3;
	} else if (z <= 4.4e-129) {
		tmp = t_1;
	} else if (z <= 4e-61) {
		tmp = t_3;
	} else if (z <= 1.1e+72) {
		tmp = t_1;
	} else if (z <= 2.65e+278) {
		tmp = t * -z;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (1.0 - y)
	t_2 = x + (x * z)
	t_3 = x + (y * t)
	tmp = 0
	if z <= -8000000.0:
		tmp = t_2
	elif z <= -4.7e-228:
		tmp = t_3
	elif z <= 4.4e-129:
		tmp = t_1
	elif z <= 4e-61:
		tmp = t_3
	elif z <= 1.1e+72:
		tmp = t_1
	elif z <= 2.65e+278:
		tmp = t * -z
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(1.0 - y))
	t_2 = Float64(x + Float64(x * z))
	t_3 = Float64(x + Float64(y * t))
	tmp = 0.0
	if (z <= -8000000.0)
		tmp = t_2;
	elseif (z <= -4.7e-228)
		tmp = t_3;
	elseif (z <= 4.4e-129)
		tmp = t_1;
	elseif (z <= 4e-61)
		tmp = t_3;
	elseif (z <= 1.1e+72)
		tmp = t_1;
	elseif (z <= 2.65e+278)
		tmp = Float64(t * Float64(-z));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (1.0 - y);
	t_2 = x + (x * z);
	t_3 = x + (y * t);
	tmp = 0.0;
	if (z <= -8000000.0)
		tmp = t_2;
	elseif (z <= -4.7e-228)
		tmp = t_3;
	elseif (z <= 4.4e-129)
		tmp = t_1;
	elseif (z <= 4e-61)
		tmp = t_3;
	elseif (z <= 1.1e+72)
		tmp = t_1;
	elseif (z <= 2.65e+278)
		tmp = t * -z;
	else
		tmp = t_2;
	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[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8000000.0], t$95$2, If[LessEqual[z, -4.7e-228], t$95$3, If[LessEqual[z, 4.4e-129], t$95$1, If[LessEqual[z, 4e-61], t$95$3, If[LessEqual[z, 1.1e+72], t$95$1, If[LessEqual[z, 2.65e+278], N[(t * (-z)), $MachinePrecision], t$95$2]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -4.7 \cdot 10^{-228}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 4.4 \cdot 10^{-129}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 4 \cdot 10^{-61}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 1.1 \cdot 10^{+72}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 2.65 \cdot 10^{+278}:\\
\;\;\;\;t \cdot \left(-z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -8e6 or 2.64999999999999996e278 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -8e6 < z < -4.7000000000000002e-228 or 4.40000000000000006e-129 < z < 4.0000000000000002e-61

    1. Initial program 99.9%

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

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

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

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

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

    if -4.7000000000000002e-228 < z < 4.40000000000000006e-129 or 4.0000000000000002e-61 < z < 1.1e72

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if 1.1e72 < z < 2.64999999999999996e278

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
      3. *-commutative52.1%

        \[\leadsto x - \color{blue}{z \cdot t} \]
    5. Simplified52.1%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8000000:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;z \leq -4.7 \cdot 10^{-228}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-129}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-61}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+72}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{+278}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot z\\ \end{array} \]

Alternative 3: 51.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(1 - y\right)\\ t_2 := x + x \cdot z\\ t_3 := x + y \cdot t\\ \mathbf{if}\;z \leq -0.42:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.12 \cdot 10^{-225}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-128}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-61}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{+78}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+280}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- 1.0 y))) (t_2 (+ x (* x z))) (t_3 (+ x (* y t))))
   (if (<= z -0.42)
     t_2
     (if (<= z -1.12e-225)
       t_3
       (if (<= z 1.8e-128)
         t_1
         (if (<= z 3.1e-61)
           t_3
           (if (<= z 1.4e+78) t_1 (if (<= z 1.1e+280) (- x (* z t)) t_2))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - y);
	double t_2 = x + (x * z);
	double t_3 = x + (y * t);
	double tmp;
	if (z <= -0.42) {
		tmp = t_2;
	} else if (z <= -1.12e-225) {
		tmp = t_3;
	} else if (z <= 1.8e-128) {
		tmp = t_1;
	} else if (z <= 3.1e-61) {
		tmp = t_3;
	} else if (z <= 1.4e+78) {
		tmp = t_1;
	} else if (z <= 1.1e+280) {
		tmp = x - (z * t);
	} 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 = x * (1.0d0 - y)
    t_2 = x + (x * z)
    t_3 = x + (y * t)
    if (z <= (-0.42d0)) then
        tmp = t_2
    else if (z <= (-1.12d-225)) then
        tmp = t_3
    else if (z <= 1.8d-128) then
        tmp = t_1
    else if (z <= 3.1d-61) then
        tmp = t_3
    else if (z <= 1.4d+78) then
        tmp = t_1
    else if (z <= 1.1d+280) then
        tmp = x - (z * t)
    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 = x * (1.0 - y);
	double t_2 = x + (x * z);
	double t_3 = x + (y * t);
	double tmp;
	if (z <= -0.42) {
		tmp = t_2;
	} else if (z <= -1.12e-225) {
		tmp = t_3;
	} else if (z <= 1.8e-128) {
		tmp = t_1;
	} else if (z <= 3.1e-61) {
		tmp = t_3;
	} else if (z <= 1.4e+78) {
		tmp = t_1;
	} else if (z <= 1.1e+280) {
		tmp = x - (z * t);
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (1.0 - y)
	t_2 = x + (x * z)
	t_3 = x + (y * t)
	tmp = 0
	if z <= -0.42:
		tmp = t_2
	elif z <= -1.12e-225:
		tmp = t_3
	elif z <= 1.8e-128:
		tmp = t_1
	elif z <= 3.1e-61:
		tmp = t_3
	elif z <= 1.4e+78:
		tmp = t_1
	elif z <= 1.1e+280:
		tmp = x - (z * t)
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(1.0 - y))
	t_2 = Float64(x + Float64(x * z))
	t_3 = Float64(x + Float64(y * t))
	tmp = 0.0
	if (z <= -0.42)
		tmp = t_2;
	elseif (z <= -1.12e-225)
		tmp = t_3;
	elseif (z <= 1.8e-128)
		tmp = t_1;
	elseif (z <= 3.1e-61)
		tmp = t_3;
	elseif (z <= 1.4e+78)
		tmp = t_1;
	elseif (z <= 1.1e+280)
		tmp = Float64(x - Float64(z * t));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (1.0 - y);
	t_2 = x + (x * z);
	t_3 = x + (y * t);
	tmp = 0.0;
	if (z <= -0.42)
		tmp = t_2;
	elseif (z <= -1.12e-225)
		tmp = t_3;
	elseif (z <= 1.8e-128)
		tmp = t_1;
	elseif (z <= 3.1e-61)
		tmp = t_3;
	elseif (z <= 1.4e+78)
		tmp = t_1;
	elseif (z <= 1.1e+280)
		tmp = x - (z * t);
	else
		tmp = t_2;
	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[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.42], t$95$2, If[LessEqual[z, -1.12e-225], t$95$3, If[LessEqual[z, 1.8e-128], t$95$1, If[LessEqual[z, 3.1e-61], t$95$3, If[LessEqual[z, 1.4e+78], t$95$1, If[LessEqual[z, 1.1e+280], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.12 \cdot 10^{-225}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{-128}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 3.1 \cdot 10^{-61}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 1.4 \cdot 10^{+78}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1.1 \cdot 10^{+280}:\\
\;\;\;\;x - z \cdot t\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -0.419999999999999984 < z < -1.12000000000000003e-225 or 1.80000000000000012e-128 < z < 3.09999999999999995e-61

    1. Initial program 99.9%

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

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

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

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

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

    if -1.12000000000000003e-225 < z < 1.80000000000000012e-128 or 3.09999999999999995e-61 < z < 1.4000000000000001e78

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if 1.4000000000000001e78 < z < 1.10000000000000008e280

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
      3. *-commutative52.1%

        \[\leadsto x - \color{blue}{z \cdot t} \]
    5. Simplified52.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.42:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;z \leq -1.12 \cdot 10^{-225}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-128}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-61}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{+78}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+280}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot z\\ \end{array} \]

Alternative 4: 51.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + x \cdot z\\ t_2 := x + y \cdot t\\ \mathbf{if}\;z \leq -22000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{-231}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-128}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-61}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{+62}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+279}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* x z))) (t_2 (+ x (* y t))))
   (if (<= z -22000000.0)
     t_1
     (if (<= z -7.5e-231)
       t_2
       (if (<= z 1.55e-128)
         (- x (* x y))
         (if (<= z 3.6e-61)
           t_2
           (if (<= z 3.1e+62)
             (* x (- 1.0 y))
             (if (<= z 1.5e+279) (- x (* z t)) t_1))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x + (x * z);
	double t_2 = x + (y * t);
	double tmp;
	if (z <= -22000000.0) {
		tmp = t_1;
	} else if (z <= -7.5e-231) {
		tmp = t_2;
	} else if (z <= 1.55e-128) {
		tmp = x - (x * y);
	} else if (z <= 3.6e-61) {
		tmp = t_2;
	} else if (z <= 3.1e+62) {
		tmp = x * (1.0 - y);
	} else if (z <= 1.5e+279) {
		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) :: t_2
    real(8) :: tmp
    t_1 = x + (x * z)
    t_2 = x + (y * t)
    if (z <= (-22000000.0d0)) then
        tmp = t_1
    else if (z <= (-7.5d-231)) then
        tmp = t_2
    else if (z <= 1.55d-128) then
        tmp = x - (x * y)
    else if (z <= 3.6d-61) then
        tmp = t_2
    else if (z <= 3.1d+62) then
        tmp = x * (1.0d0 - y)
    else if (z <= 1.5d+279) 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 + (x * z);
	double t_2 = x + (y * t);
	double tmp;
	if (z <= -22000000.0) {
		tmp = t_1;
	} else if (z <= -7.5e-231) {
		tmp = t_2;
	} else if (z <= 1.55e-128) {
		tmp = x - (x * y);
	} else if (z <= 3.6e-61) {
		tmp = t_2;
	} else if (z <= 3.1e+62) {
		tmp = x * (1.0 - y);
	} else if (z <= 1.5e+279) {
		tmp = x - (z * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + (x * z)
	t_2 = x + (y * t)
	tmp = 0
	if z <= -22000000.0:
		tmp = t_1
	elif z <= -7.5e-231:
		tmp = t_2
	elif z <= 1.55e-128:
		tmp = x - (x * y)
	elif z <= 3.6e-61:
		tmp = t_2
	elif z <= 3.1e+62:
		tmp = x * (1.0 - y)
	elif z <= 1.5e+279:
		tmp = x - (z * t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(x * z))
	t_2 = Float64(x + Float64(y * t))
	tmp = 0.0
	if (z <= -22000000.0)
		tmp = t_1;
	elseif (z <= -7.5e-231)
		tmp = t_2;
	elseif (z <= 1.55e-128)
		tmp = Float64(x - Float64(x * y));
	elseif (z <= 3.6e-61)
		tmp = t_2;
	elseif (z <= 3.1e+62)
		tmp = Float64(x * Float64(1.0 - y));
	elseif (z <= 1.5e+279)
		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 + (x * z);
	t_2 = x + (y * t);
	tmp = 0.0;
	if (z <= -22000000.0)
		tmp = t_1;
	elseif (z <= -7.5e-231)
		tmp = t_2;
	elseif (z <= 1.55e-128)
		tmp = x - (x * y);
	elseif (z <= 3.6e-61)
		tmp = t_2;
	elseif (z <= 3.1e+62)
		tmp = x * (1.0 - y);
	elseif (z <= 1.5e+279)
		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[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -22000000.0], t$95$1, If[LessEqual[z, -7.5e-231], t$95$2, If[LessEqual[z, 1.55e-128], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e-61], t$95$2, If[LessEqual[z, 3.1e+62], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e+279], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + x \cdot z\\
t_2 := x + y \cdot t\\
\mathbf{if}\;z \leq -22000000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -7.5 \cdot 10^{-231}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 1.55 \cdot 10^{-128}:\\
\;\;\;\;x - x \cdot y\\

\mathbf{elif}\;z \leq 3.6 \cdot 10^{-61}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;z \leq 1.5 \cdot 10^{+279}:\\
\;\;\;\;x - z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -2.2e7 or 1.4999999999999999e279 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -2.2e7 < z < -7.5000000000000001e-231 or 1.55000000000000001e-128 < z < 3.60000000000000014e-61

    1. Initial program 99.9%

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

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

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

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

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

    if -7.5000000000000001e-231 < z < 1.55000000000000001e-128

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto x + \color{blue}{\left(-x \cdot y\right)} \]
      2. distribute-lft-neg-out78.1%

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

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

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

    if 3.60000000000000014e-61 < z < 3.10000000000000014e62

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if 3.10000000000000014e62 < z < 1.4999999999999999e279

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
      3. *-commutative52.1%

        \[\leadsto x - \color{blue}{z \cdot t} \]
    5. Simplified52.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -22000000:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{-231}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-128}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-61}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{+62}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+279}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot z\\ \end{array} \]

Alternative 5: 45.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(1 - y\right)\\ t_2 := t \cdot \left(-z\right)\\ \mathbf{if}\;z \leq -1.8 \cdot 10^{+146}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{-14}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{-106}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-226}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{+71}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- 1.0 y))) (t_2 (* t (- z))))
   (if (<= z -1.8e+146)
     t_2
     (if (<= z -2.8e-14)
       (* y t)
       (if (<= z -7.5e-106)
         t_1
         (if (<= z -6.2e-226) (* y t) (if (<= z 5.8e+71) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - y);
	double t_2 = t * -z;
	double tmp;
	if (z <= -1.8e+146) {
		tmp = t_2;
	} else if (z <= -2.8e-14) {
		tmp = y * t;
	} else if (z <= -7.5e-106) {
		tmp = t_1;
	} else if (z <= -6.2e-226) {
		tmp = y * t;
	} else if (z <= 5.8e+71) {
		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) :: tmp
    t_1 = x * (1.0d0 - y)
    t_2 = t * -z
    if (z <= (-1.8d+146)) then
        tmp = t_2
    else if (z <= (-2.8d-14)) then
        tmp = y * t
    else if (z <= (-7.5d-106)) then
        tmp = t_1
    else if (z <= (-6.2d-226)) then
        tmp = y * t
    else if (z <= 5.8d+71) 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 = x * (1.0 - y);
	double t_2 = t * -z;
	double tmp;
	if (z <= -1.8e+146) {
		tmp = t_2;
	} else if (z <= -2.8e-14) {
		tmp = y * t;
	} else if (z <= -7.5e-106) {
		tmp = t_1;
	} else if (z <= -6.2e-226) {
		tmp = y * t;
	} else if (z <= 5.8e+71) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (1.0 - y)
	t_2 = t * -z
	tmp = 0
	if z <= -1.8e+146:
		tmp = t_2
	elif z <= -2.8e-14:
		tmp = y * t
	elif z <= -7.5e-106:
		tmp = t_1
	elif z <= -6.2e-226:
		tmp = y * t
	elif z <= 5.8e+71:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(1.0 - y))
	t_2 = Float64(t * Float64(-z))
	tmp = 0.0
	if (z <= -1.8e+146)
		tmp = t_2;
	elseif (z <= -2.8e-14)
		tmp = Float64(y * t);
	elseif (z <= -7.5e-106)
		tmp = t_1;
	elseif (z <= -6.2e-226)
		tmp = Float64(y * t);
	elseif (z <= 5.8e+71)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (1.0 - y);
	t_2 = t * -z;
	tmp = 0.0;
	if (z <= -1.8e+146)
		tmp = t_2;
	elseif (z <= -2.8e-14)
		tmp = y * t;
	elseif (z <= -7.5e-106)
		tmp = t_1;
	elseif (z <= -6.2e-226)
		tmp = y * t;
	elseif (z <= 5.8e+71)
		tmp = t_1;
	else
		tmp = t_2;
	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[(t * (-z)), $MachinePrecision]}, If[LessEqual[z, -1.8e+146], t$95$2, If[LessEqual[z, -2.8e-14], N[(y * t), $MachinePrecision], If[LessEqual[z, -7.5e-106], t$95$1, If[LessEqual[z, -6.2e-226], N[(y * t), $MachinePrecision], If[LessEqual[z, 5.8e+71], t$95$1, t$95$2]]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;z \leq -6.2 \cdot 10^{-226}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 5.8 \cdot 10^{+71}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.7999999999999999e146 or 5.80000000000000014e71 < z

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
      3. *-commutative50.2%

        \[\leadsto x - \color{blue}{z \cdot t} \]
    5. Simplified50.2%

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

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

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

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

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

    if -1.7999999999999999e146 < z < -2.8000000000000001e-14 or -7.5000000000000002e-106 < z < -6.19999999999999978e-226

    1. Initial program 100.0%

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

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

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

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

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

    if -2.8000000000000001e-14 < z < -7.5000000000000002e-106 or -6.19999999999999978e-226 < z < 5.80000000000000014e71

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.8 \cdot 10^{+146}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{-14}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{-106}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-226}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{+71}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \end{array} \]

Alternative 6: 44.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_1 := x + x \cdot z\\
\mathbf{if}\;z \leq -2.25 \cdot 10^{-46}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -2.45 \cdot 10^{-222}:\\
\;\;\;\;y \cdot t\\

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

\mathbf{elif}\;z \leq 3.2 \cdot 10^{+279}:\\
\;\;\;\;t \cdot \left(-z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.25e-46 or 3.19999999999999988e279 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -2.25e-46 < z < -2.45e-222

    1. Initial program 100.0%

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

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

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

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

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

    if -2.45e-222 < z < 9.5000000000000006e78

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if 9.5000000000000006e78 < z < 3.19999999999999988e279

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
      3. *-commutative52.1%

        \[\leadsto x - \color{blue}{z \cdot t} \]
    5. Simplified52.1%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.25 \cdot 10^{-46}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;z \leq -2.45 \cdot 10^{-222}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+78}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+279}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot z\\ \end{array} \]

Alternative 7: 69.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+241}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\

\mathbf{elif}\;x \leq -1.75 \cdot 10^{+85}:\\
\;\;\;\;x + x \cdot z\\

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

\mathbf{else}:\\
\;\;\;\;x - x \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.55e241

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -1.55e241 < x < -1.75000000000000003e85

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -1.75000000000000003e85 < x < 1.3e21

    1. Initial program 100.0%

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

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

    if 1.3e21 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.55 \cdot 10^{+241}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{+85}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+21}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot y\\ \end{array} \]

Alternative 8: 81.2% accurate, 0.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.6e7 or 2.4000000000000001e106 < z

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto x + \color{blue}{\left(t - x\right) \cdot \left(-z\right)} \]
    5. Step-by-step derivation
      1. distribute-rgt-neg-out89.1%

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

        \[\leadsto \color{blue}{x - \left(t - x\right) \cdot z} \]
    6. Applied egg-rr89.1%

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

    if -2.6e7 < z < -2.04999999999999983e-170

    1. Initial program 100.0%

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

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

    if -2.04999999999999983e-170 < z < 2.4000000000000001e106

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -26000000:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq -2.05 \cdot 10^{-170}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{+106}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 9: 81.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{+85} \lor \neg \left(x \leq 1.16 \cdot 10^{+21}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.50000000000000008e85 or 1.16e21 < x

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto x + \color{blue}{\mathsf{fma}\left(t - x, y, \left(t - x\right) \cdot \left(-z\right)\right)} \]
    3. Applied egg-rr98.2%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(t - x, y, \left(t - x\right) \cdot \left(-z\right)\right)} \]
    4. Taylor expanded in t around 0 86.6%

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

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

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

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

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

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

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

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

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

    if -5.50000000000000008e85 < x < 1.16e21

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{+85} \lor \neg \left(x \leq 1.16 \cdot 10^{+21}\right):\\ \;\;\;\;x + x \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \end{array} \]

Alternative 10: 38.8% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.06 \cdot 10^{+73} \lor \neg \left(y \leq 3.5 \cdot 10^{-29}\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.0600000000000001e73 or 3.4999999999999997e-29 < y

    1. Initial program 100.0%

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

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

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

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

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

    if -1.0600000000000001e73 < y < 3.4999999999999997e-29

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
      3. *-commutative61.0%

        \[\leadsto x - \color{blue}{z \cdot t} \]
    5. Simplified61.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(-t\right) \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification41.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.06 \cdot 10^{+73} \lor \neg \left(y \leq 3.5 \cdot 10^{-29}\right):\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \end{array} \]

Alternative 11: 37.1% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-57} \lor \neg \left(y \leq 5.2 \cdot 10^{-63}\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.49999999999999992e-57 or 5.2000000000000003e-63 < y

    1. Initial program 100.0%

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

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

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

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

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

    if -6.49999999999999992e-57 < y < 5.2000000000000003e-63

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.5 \cdot 10^{-57} \lor \neg \left(y \leq 5.2 \cdot 10^{-63}\right):\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 12: 17.7% 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 60.6%

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

    \[\leadsto \color{blue}{x} \]
  4. Final simplification14.2%

    \[\leadsto x \]

Developer target: 96.6% 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 2023336 
(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))))