Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 7.7s
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: 68.1% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;z \leq -4.8 \cdot 10^{-166}:\\
\;\;\;\;\left(y - z\right) \cdot t\\

\mathbf{elif}\;z \leq -1.05 \cdot 10^{-194}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq 6.1:\\
\;\;\;\;t_1\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -1.99999999999999997e77 < z < -4.7999999999999997e-166

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Simplified81.8%

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

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

    if -4.7999999999999997e-166 < z < -1.05e-194 or 6.5000000000000006e-238 < z < 6.0999999999999996

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -1.05e-194 < z < 6.5000000000000006e-238

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2 \cdot 10^{+77}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq -4.8 \cdot 10^{-166}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{-194}:\\ \;\;\;\;x - y \cdot x\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-238}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 6.1:\\ \;\;\;\;x - y \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 3: 75.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := x + \left(y - z\right) \cdot t\\ \mathbf{if}\;z \leq -8.5 \cdot 10^{+75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-225}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 3 \cdot 10^{-169}:\\ \;\;\;\;x - y \cdot x\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+48}:\\ \;\;\;\;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 z) t))))
   (if (<= z -8.5e+75)
     t_1
     (if (<= z 9.5e-225)
       t_2
       (if (<= z 3e-169) (- x (* y x)) (if (<= z 5.6e+48) 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 - z) * t);
	double tmp;
	if (z <= -8.5e+75) {
		tmp = t_1;
	} else if (z <= 9.5e-225) {
		tmp = t_2;
	} else if (z <= 3e-169) {
		tmp = x - (y * x);
	} else if (z <= 5.6e+48) {
		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 - z) * t)
    if (z <= (-8.5d+75)) then
        tmp = t_1
    else if (z <= 9.5d-225) then
        tmp = t_2
    else if (z <= 3d-169) then
        tmp = x - (y * x)
    else if (z <= 5.6d+48) 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 - z) * t);
	double tmp;
	if (z <= -8.5e+75) {
		tmp = t_1;
	} else if (z <= 9.5e-225) {
		tmp = t_2;
	} else if (z <= 3e-169) {
		tmp = x - (y * x);
	} else if (z <= 5.6e+48) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x - t)
	t_2 = x + ((y - z) * t)
	tmp = 0
	if z <= -8.5e+75:
		tmp = t_1
	elif z <= 9.5e-225:
		tmp = t_2
	elif z <= 3e-169:
		tmp = x - (y * x)
	elif z <= 5.6e+48:
		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(Float64(y - z) * t))
	tmp = 0.0
	if (z <= -8.5e+75)
		tmp = t_1;
	elseif (z <= 9.5e-225)
		tmp = t_2;
	elseif (z <= 3e-169)
		tmp = Float64(x - Float64(y * x));
	elseif (z <= 5.6e+48)
		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 - z) * t);
	tmp = 0.0;
	if (z <= -8.5e+75)
		tmp = t_1;
	elseif (z <= 9.5e-225)
		tmp = t_2;
	elseif (z <= 3e-169)
		tmp = x - (y * x);
	elseif (z <= 5.6e+48)
		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[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e+75], t$95$1, If[LessEqual[z, 9.5e-225], t$95$2, If[LessEqual[z, 3e-169], N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.6e+48], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 9.5 \cdot 10^{-225}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 3 \cdot 10^{-169}:\\
\;\;\;\;x - y \cdot x\\

\mathbf{elif}\;z \leq 5.6 \cdot 10^{+48}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -8.4999999999999993e75 or 5.60000000000000025e48 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -8.4999999999999993e75 < z < 9.50000000000000006e-225 or 2.9999999999999999e-169 < z < 5.60000000000000025e48

    1. Initial program 100.0%

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

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

    if 9.50000000000000006e-225 < z < 2.9999999999999999e-169

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.5 \cdot 10^{+75}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-225}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq 3 \cdot 10^{-169}:\\ \;\;\;\;x - y \cdot x\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+48}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 4: 38.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(-x\right)\\ t_2 := z \cdot \left(-t\right)\\ \mathbf{if}\;y \leq -1.05 \cdot 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.22 \cdot 10^{-188}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-133}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+74}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+239}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (- x))) (t_2 (* z (- t))))
   (if (<= y -1.05e+37)
     t_1
     (if (<= y 1.22e-188)
       t_2
       (if (<= y 1.3e-133)
         (* z x)
         (if (<= y 1.6e+74) t_2 (if (<= y 2.3e+239) (* y t) t_1)))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * -x;
	double t_2 = z * -t;
	double tmp;
	if (y <= -1.05e+37) {
		tmp = t_1;
	} else if (y <= 1.22e-188) {
		tmp = t_2;
	} else if (y <= 1.3e-133) {
		tmp = z * x;
	} else if (y <= 1.6e+74) {
		tmp = t_2;
	} else if (y <= 2.3e+239) {
		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) :: t_2
    real(8) :: tmp
    t_1 = y * -x
    t_2 = z * -t
    if (y <= (-1.05d+37)) then
        tmp = t_1
    else if (y <= 1.22d-188) then
        tmp = t_2
    else if (y <= 1.3d-133) then
        tmp = z * x
    else if (y <= 1.6d+74) then
        tmp = t_2
    else if (y <= 2.3d+239) 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 t_2 = z * -t;
	double tmp;
	if (y <= -1.05e+37) {
		tmp = t_1;
	} else if (y <= 1.22e-188) {
		tmp = t_2;
	} else if (y <= 1.3e-133) {
		tmp = z * x;
	} else if (y <= 1.6e+74) {
		tmp = t_2;
	} else if (y <= 2.3e+239) {
		tmp = y * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * -x
	t_2 = z * -t
	tmp = 0
	if y <= -1.05e+37:
		tmp = t_1
	elif y <= 1.22e-188:
		tmp = t_2
	elif y <= 1.3e-133:
		tmp = z * x
	elif y <= 1.6e+74:
		tmp = t_2
	elif y <= 2.3e+239:
		tmp = y * t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(-x))
	t_2 = Float64(z * Float64(-t))
	tmp = 0.0
	if (y <= -1.05e+37)
		tmp = t_1;
	elseif (y <= 1.22e-188)
		tmp = t_2;
	elseif (y <= 1.3e-133)
		tmp = Float64(z * x);
	elseif (y <= 1.6e+74)
		tmp = t_2;
	elseif (y <= 2.3e+239)
		tmp = Float64(y * t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * -x;
	t_2 = z * -t;
	tmp = 0.0;
	if (y <= -1.05e+37)
		tmp = t_1;
	elseif (y <= 1.22e-188)
		tmp = t_2;
	elseif (y <= 1.3e-133)
		tmp = z * x;
	elseif (y <= 1.6e+74)
		tmp = t_2;
	elseif (y <= 2.3e+239)
		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]}, Block[{t$95$2 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -1.05e+37], t$95$1, If[LessEqual[y, 1.22e-188], t$95$2, If[LessEqual[y, 1.3e-133], N[(z * x), $MachinePrecision], If[LessEqual[y, 1.6e+74], t$95$2, If[LessEqual[y, 2.3e+239], N[(y * t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.22 \cdot 10^{-188}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;y \leq 1.6 \cdot 10^{+74}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq 2.3 \cdot 10^{+239}:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.0500000000000001e37 or 2.3000000000000002e239 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.0500000000000001e37 < y < 1.22e-188 or 1.3e-133 < y < 1.59999999999999997e74

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if 1.22e-188 < y < 1.3e-133

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

    if 1.59999999999999997e74 < y < 2.3000000000000002e239

    1. Initial program 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.05 \cdot 10^{+37}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;y \leq 1.22 \cdot 10^{-188}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-133}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+74}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+239}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \]

Alternative 5: 60.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := \left(y - z\right) \cdot t\\ \mathbf{if}\;z \leq -3.8 \cdot 10^{+75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-221}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-155}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.5 \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 (* (- y z) t)))
   (if (<= z -3.8e+75)
     t_1
     (if (<= z 8e-221)
       t_2
       (if (<= z 1.45e-155) x (if (<= z 4.5e+51) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (x - t);
	double t_2 = (y - z) * t;
	double tmp;
	if (z <= -3.8e+75) {
		tmp = t_1;
	} else if (z <= 8e-221) {
		tmp = t_2;
	} else if (z <= 1.45e-155) {
		tmp = x;
	} else if (z <= 4.5e+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 = (y - z) * t
    if (z <= (-3.8d+75)) then
        tmp = t_1
    else if (z <= 8d-221) then
        tmp = t_2
    else if (z <= 1.45d-155) then
        tmp = x
    else if (z <= 4.5d+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 = (y - z) * t;
	double tmp;
	if (z <= -3.8e+75) {
		tmp = t_1;
	} else if (z <= 8e-221) {
		tmp = t_2;
	} else if (z <= 1.45e-155) {
		tmp = x;
	} else if (z <= 4.5e+51) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x - t)
	t_2 = (y - z) * t
	tmp = 0
	if z <= -3.8e+75:
		tmp = t_1
	elif z <= 8e-221:
		tmp = t_2
	elif z <= 1.45e-155:
		tmp = x
	elif z <= 4.5e+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(Float64(y - z) * t)
	tmp = 0.0
	if (z <= -3.8e+75)
		tmp = t_1;
	elseif (z <= 8e-221)
		tmp = t_2;
	elseif (z <= 1.45e-155)
		tmp = x;
	elseif (z <= 4.5e+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 = (y - z) * t;
	tmp = 0.0;
	if (z <= -3.8e+75)
		tmp = t_1;
	elseif (z <= 8e-221)
		tmp = t_2;
	elseif (z <= 1.45e-155)
		tmp = x;
	elseif (z <= 4.5e+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[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -3.8e+75], t$95$1, If[LessEqual[z, 8e-221], t$95$2, If[LessEqual[z, 1.45e-155], x, If[LessEqual[z, 4.5e+51], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 8 \cdot 10^{-221}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 1.45 \cdot 10^{-155}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.8000000000000002e75 or 4.5e51 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -3.8000000000000002e75 < z < 8.00000000000000014e-221 or 1.45000000000000005e-155 < z < 4.5e51

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if 8.00000000000000014e-221 < z < 1.45000000000000005e-155

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+75}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-221}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-155}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{+51}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 6: 83.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -3 \cdot 10^{+76}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-86}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq 6.5:\\ \;\;\;\;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 (* z (- x t))))
   (if (<= z -3e+76)
     t_1
     (if (<= z -8e-86)
       (+ x (* (- y z) t))
       (if (<= z 6.5) (+ x (* y (- t x))) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (x - t);
	double tmp;
	if (z <= -3e+76) {
		tmp = t_1;
	} else if (z <= -8e-86) {
		tmp = x + ((y - z) * t);
	} else if (z <= 6.5) {
		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 = z * (x - t)
    if (z <= (-3d+76)) then
        tmp = t_1
    else if (z <= (-8d-86)) then
        tmp = x + ((y - z) * t)
    else if (z <= 6.5d0) 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 = z * (x - t);
	double tmp;
	if (z <= -3e+76) {
		tmp = t_1;
	} else if (z <= -8e-86) {
		tmp = x + ((y - z) * t);
	} else if (z <= 6.5) {
		tmp = x + (y * (t - x));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x - t)
	tmp = 0
	if z <= -3e+76:
		tmp = t_1
	elif z <= -8e-86:
		tmp = x + ((y - z) * t)
	elif z <= 6.5:
		tmp = x + (y * (t - 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 <= -3e+76)
		tmp = t_1;
	elseif (z <= -8e-86)
		tmp = Float64(x + Float64(Float64(y - z) * t));
	elseif (z <= 6.5)
		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 = z * (x - t);
	tmp = 0.0;
	if (z <= -3e+76)
		tmp = t_1;
	elseif (z <= -8e-86)
		tmp = x + ((y - z) * t);
	elseif (z <= 6.5)
		tmp = x + (y * (t - 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, -3e+76], t$95$1, If[LessEqual[z, -8e-86], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq 6.5:\\
\;\;\;\;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.9999999999999998e76 or 6.5 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -2.9999999999999998e76 < z < -8.00000000000000068e-86

    1. Initial program 100.0%

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

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

    if -8.00000000000000068e-86 < z < 6.5

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{+76}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-86}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq 6.5:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 7: 38.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;y \leq -9.5 \cdot 10^{-23}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;y \leq 1.3 \cdot 10^{-188}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;y \leq 6.8 \cdot 10^{+74}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.50000000000000058e-23 or 6.7999999999999998e74 < y

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Simplified55.6%

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

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

    if -9.50000000000000058e-23 < y < 1.3e-188 or 9.000000000000001e-134 < y < 6.7999999999999998e74

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if 1.3e-188 < y < 9.000000000000001e-134

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{-23}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-188}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-134}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{+74}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]

Alternative 8: 38.1% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+76}:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;z \leq 7.5 \cdot 10^{-229}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 3 \cdot 10^{-159}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 10^{+51}:\\
\;\;\;\;y \cdot t\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -8.9999999999999995e76 < z < 7.4999999999999999e-229 or 3.00000000000000009e-159 < z < 1e51

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Simplified76.9%

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

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

    if 7.4999999999999999e-229 < z < 3.00000000000000009e-159

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{+76}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-229}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 3 \cdot 10^{-159}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 10^{+51}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]

Alternative 9: 53.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -2.25 \cdot 10^{-156}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -7.8 \cdot 10^{-249}:\\
\;\;\;\;y \cdot \left(-x\right)\\

\mathbf{elif}\;t \leq 1.02 \cdot 10^{-111}:\\
\;\;\;\;z \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.24999999999999993e-156 or 1.02000000000000003e-111 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -2.24999999999999993e-156 < t < -7.7999999999999998e-249

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.7999999999999998e-249 < t < 1.02000000000000003e-111

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.25 \cdot 10^{-156}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;t \leq -7.8 \cdot 10^{-249}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;t \leq 1.02 \cdot 10^{-111}:\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \end{array} \]

Alternative 10: 82.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+65} \lor \neg \left(y \leq 5.5 \cdot 10^{+76}\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.20000000000000007e65 or 5.5000000000000001e76 < y

    1. Initial program 100.0%

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

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

    if -3.20000000000000007e65 < y < 5.5000000000000001e76

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

Alternative 11: 71.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-16} \lor \neg \left(z \leq 0.455\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -1.4499999999999999e-16 < z < 0.455000000000000016

    1. Initial program 100.0%

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

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

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

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

Alternative 12: 100.0% accurate, 1.0× speedup?

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

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

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

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

Alternative 13: 37.8% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;y \leq 1.45 \cdot 10^{-5}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.4e-16 or 1.45e-5 < y

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Simplified55.9%

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

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

    if -3.4e-16 < y < 1.45e-5

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.4 \cdot 10^{-16}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-5}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]

Alternative 14: 18.3% 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 13.2%

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

    \[\leadsto x \]

Developer target: 96.2% 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 2023221 
(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))))