Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 9.4s
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-define100.0%

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

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

Alternative 2: 35.2% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;z \leq -2.25 \cdot 10^{+48}:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;z \leq -1.15 \cdot 10^{-125}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 5 \cdot 10^{-157}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.19999999999999991e262 or -2.24999999999999998e48 < z < -1.15e-125 or 3.1e87 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-t \cdot z} \]
      2. *-commutative47.6%

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

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

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

    if -1.19999999999999991e262 < z < -2.24999999999999998e48

    1. Initial program 100.0%

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

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

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

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

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

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

    if -1.15e-125 < z < 5.0000000000000002e-157

    1. Initial program 100.0%

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

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

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

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

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

    if 5.0000000000000002e-157 < z < 3.1e87

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+262}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{+48}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{-125}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-157}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{+87}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 36.1% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq -2.45 \cdot 10^{-101}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 6 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

    if -13500 < z < -2.45e-101 or 2.7e-159 < z < 6e21

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -2.45e-101 < z < 2.7e-159

    1. Initial program 100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -13500:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -2.45 \cdot 10^{-101}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-159}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+21}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 71.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -6.4 \cdot 10^{+28}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-173}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+24}:\\ \;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- x t))))
   (if (<= z -6.4e+28)
     t_1
     (if (<= z 4.5e-173)
       (+ x (* y t))
       (if (<= z 3.5e+24) (* x (+ (- z y) 1.0)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (x - t);
	double tmp;
	if (z <= -6.4e+28) {
		tmp = t_1;
	} else if (z <= 4.5e-173) {
		tmp = x + (y * t);
	} else if (z <= 3.5e+24) {
		tmp = x * ((z - y) + 1.0);
	} 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 <= (-6.4d+28)) then
        tmp = t_1
    else if (z <= 4.5d-173) then
        tmp = x + (y * t)
    else if (z <= 3.5d+24) then
        tmp = x * ((z - y) + 1.0d0)
    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 <= -6.4e+28) {
		tmp = t_1;
	} else if (z <= 4.5e-173) {
		tmp = x + (y * t);
	} else if (z <= 3.5e+24) {
		tmp = x * ((z - y) + 1.0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x - t)
	tmp = 0
	if z <= -6.4e+28:
		tmp = t_1
	elif z <= 4.5e-173:
		tmp = x + (y * t)
	elif z <= 3.5e+24:
		tmp = x * ((z - y) + 1.0)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(x - t))
	tmp = 0.0
	if (z <= -6.4e+28)
		tmp = t_1;
	elseif (z <= 4.5e-173)
		tmp = Float64(x + Float64(y * t));
	elseif (z <= 3.5e+24)
		tmp = Float64(x * Float64(Float64(z - y) + 1.0));
	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 <= -6.4e+28)
		tmp = t_1;
	elseif (z <= 4.5e-173)
		tmp = x + (y * t);
	elseif (z <= 3.5e+24)
		tmp = x * ((z - y) + 1.0);
	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, -6.4e+28], t$95$1, If[LessEqual[z, 4.5e-173], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+24], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.4000000000000001e28 or 3.5000000000000002e24 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -6.4000000000000001e28 < z < 4.50000000000000018e-173

    1. Initial program 100.0%

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

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

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

    if 4.50000000000000018e-173 < z < 3.5000000000000002e24

    1. Initial program 99.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.4 \cdot 10^{+28}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-173}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+24}:\\ \;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 70.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -6.4 \cdot 10^{+28}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-173}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{+18}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- x t))))
   (if (<= z -6.4e+28)
     t_1
     (if (<= z 2.7e-173)
       (+ x (* y t))
       (if (<= z 3.8e+18) (* x (- 1.0 y)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (x - t);
	double tmp;
	if (z <= -6.4e+28) {
		tmp = t_1;
	} else if (z <= 2.7e-173) {
		tmp = x + (y * t);
	} else if (z <= 3.8e+18) {
		tmp = x * (1.0 - y);
	} 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 <= (-6.4d+28)) then
        tmp = t_1
    else if (z <= 2.7d-173) then
        tmp = x + (y * t)
    else if (z <= 3.8d+18) then
        tmp = x * (1.0d0 - y)
    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 <= -6.4e+28) {
		tmp = t_1;
	} else if (z <= 2.7e-173) {
		tmp = x + (y * t);
	} else if (z <= 3.8e+18) {
		tmp = x * (1.0 - y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x - t)
	tmp = 0
	if z <= -6.4e+28:
		tmp = t_1
	elif z <= 2.7e-173:
		tmp = x + (y * t)
	elif z <= 3.8e+18:
		tmp = x * (1.0 - y)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(x - t))
	tmp = 0.0
	if (z <= -6.4e+28)
		tmp = t_1;
	elseif (z <= 2.7e-173)
		tmp = Float64(x + Float64(y * t));
	elseif (z <= 3.8e+18)
		tmp = Float64(x * Float64(1.0 - y));
	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 <= -6.4e+28)
		tmp = t_1;
	elseif (z <= 2.7e-173)
		tmp = x + (y * t);
	elseif (z <= 3.8e+18)
		tmp = x * (1.0 - y);
	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, -6.4e+28], t$95$1, If[LessEqual[z, 2.7e-173], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e+18], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.4000000000000001e28 or 3.8e18 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -6.4000000000000001e28 < z < 2.7e-173

    1. Initial program 100.0%

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

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

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

    if 2.7e-173 < z < 3.8e18

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 6: 68.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -7.2 \cdot 10^{+28}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-166}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{+18}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- x t))))
   (if (<= z -7.2e+28)
     t_1
     (if (<= z -9.5e-166)
       (* y (- t x))
       (if (<= z 3.8e+18) (* x (- 1.0 y)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (x - t);
	double tmp;
	if (z <= -7.2e+28) {
		tmp = t_1;
	} else if (z <= -9.5e-166) {
		tmp = y * (t - x);
	} else if (z <= 3.8e+18) {
		tmp = x * (1.0 - y);
	} 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 <= (-7.2d+28)) then
        tmp = t_1
    else if (z <= (-9.5d-166)) then
        tmp = y * (t - x)
    else if (z <= 3.8d+18) then
        tmp = x * (1.0d0 - y)
    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 <= -7.2e+28) {
		tmp = t_1;
	} else if (z <= -9.5e-166) {
		tmp = y * (t - x);
	} else if (z <= 3.8e+18) {
		tmp = x * (1.0 - y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x - t)
	tmp = 0
	if z <= -7.2e+28:
		tmp = t_1
	elif z <= -9.5e-166:
		tmp = y * (t - x)
	elif z <= 3.8e+18:
		tmp = x * (1.0 - y)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(x - t))
	tmp = 0.0
	if (z <= -7.2e+28)
		tmp = t_1;
	elseif (z <= -9.5e-166)
		tmp = Float64(y * Float64(t - x));
	elseif (z <= 3.8e+18)
		tmp = Float64(x * Float64(1.0 - y));
	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 <= -7.2e+28)
		tmp = t_1;
	elseif (z <= -9.5e-166)
		tmp = y * (t - x);
	elseif (z <= 3.8e+18)
		tmp = x * (1.0 - y);
	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, -7.2e+28], t$95$1, If[LessEqual[z, -9.5e-166], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e+18], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -7.1999999999999999e28 or 3.8e18 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -7.1999999999999999e28 < z < -9.50000000000000046e-166

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.50000000000000046e-166 < z < 3.8e18

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 7: 49.2% accurate, 0.4× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.40000000000000029e262 or 2.2000000000000001e87 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-t \cdot z} \]
      2. *-commutative54.6%

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

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

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

    if -9.40000000000000029e262 < z < -1.72e-6

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if -1.72e-6 < z < 2.2000000000000001e87

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 8: 84.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{+28} \lor \neg \left(z \leq 1.56 \cdot 10^{+22}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -6.8e28 < z < 1.56e22

    1. Initial program 100.0%

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

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

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

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

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

Alternative 9: 84.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -0.175:\\ \;\;\;\;x + t\_1\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{+20}:\\ \;\;\;\;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 -0.175) (+ x t_1) (if (<= z 3.9e+20) (+ 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 <= -0.175) {
		tmp = x + t_1;
	} else if (z <= 3.9e+20) {
		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 <= (-0.175d0)) then
        tmp = x + t_1
    else if (z <= 3.9d+20) 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 <= -0.175) {
		tmp = x + t_1;
	} else if (z <= 3.9e+20) {
		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 <= -0.175:
		tmp = x + t_1
	elif z <= 3.9e+20:
		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 <= -0.175)
		tmp = Float64(x + t_1);
	elseif (z <= 3.9e+20)
		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 <= -0.175)
		tmp = x + t_1;
	elseif (z <= 3.9e+20)
		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, -0.175], N[(x + t$95$1), $MachinePrecision], If[LessEqual[z, 3.9e+20], 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 -0.175:\\
\;\;\;\;x + t\_1\\

\mathbf{elif}\;z \leq 3.9 \cdot 10^{+20}:\\
\;\;\;\;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 < -0.17499999999999999

    1. Initial program 100.0%

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

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

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

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

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

    if -0.17499999999999999 < z < 3.9e20

    1. Initial program 100.0%

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

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

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

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

    if 3.9e20 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 10: 65.7% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -150000 \lor \neg \left(y \leq 5.4 \cdot 10^{+63}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.5e5 or 5.40000000000000035e63 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x + \color{blue}{t \cdot \left(y - z\right)}\right) - x \cdot y \]
    9. Applied egg-rr88.3%

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

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

    if -1.5e5 < y < 5.40000000000000035e63

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

Alternative 11: 45.3% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.49999999999999984e-50 or 1.40000000000000008e54 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-t \cdot z} \]
      2. *-commutative44.4%

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

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

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

    if -2.49999999999999984e-50 < t < 1.40000000000000008e54

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

Alternative 12: 36.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \lor \neg \left(z \leq 1.6 \cdot 10^{-15}\right):\\
\;\;\;\;z \cdot x\\

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

    if -1.02 < z < 1.6e-15

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 13: 100.0% accurate, 1.0× speedup?

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

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

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

Alternative 14: 17.5% accurate, 9.0× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  7. Add Preprocessing

Developer Target 1: 96.0% 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 2024130 
(FPCore (x y z t)
  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
  :precision binary64

  :alt
  (! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))

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