Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 9.7s
Alternatives: 15
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 15 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: 38.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(-t\right)\\ \mathbf{if}\;z \leq -7.2 \cdot 10^{+187}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-28}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-271}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 7500:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+130} \lor \neg \left(z \leq 5.5 \cdot 10^{+282}\right):\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- t))))
   (if (<= z -7.2e+187)
     (* z x)
     (if (<= z -1.75e-28)
       t_1
       (if (<= z 1.8e-271)
         x
         (if (<= z 7500.0)
           (* y t)
           (if (or (<= z 5.5e+130) (not (<= z 5.5e+282))) (* z x) t_1)))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * -t;
	double tmp;
	if (z <= -7.2e+187) {
		tmp = z * x;
	} else if (z <= -1.75e-28) {
		tmp = t_1;
	} else if (z <= 1.8e-271) {
		tmp = x;
	} else if (z <= 7500.0) {
		tmp = y * t;
	} else if ((z <= 5.5e+130) || !(z <= 5.5e+282)) {
		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 = z * -t
    if (z <= (-7.2d+187)) then
        tmp = z * x
    else if (z <= (-1.75d-28)) then
        tmp = t_1
    else if (z <= 1.8d-271) then
        tmp = x
    else if (z <= 7500.0d0) then
        tmp = y * t
    else if ((z <= 5.5d+130) .or. (.not. (z <= 5.5d+282))) 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 = z * -t;
	double tmp;
	if (z <= -7.2e+187) {
		tmp = z * x;
	} else if (z <= -1.75e-28) {
		tmp = t_1;
	} else if (z <= 1.8e-271) {
		tmp = x;
	} else if (z <= 7500.0) {
		tmp = y * t;
	} else if ((z <= 5.5e+130) || !(z <= 5.5e+282)) {
		tmp = z * x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * -t
	tmp = 0
	if z <= -7.2e+187:
		tmp = z * x
	elif z <= -1.75e-28:
		tmp = t_1
	elif z <= 1.8e-271:
		tmp = x
	elif z <= 7500.0:
		tmp = y * t
	elif (z <= 5.5e+130) or not (z <= 5.5e+282):
		tmp = z * x
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(-t))
	tmp = 0.0
	if (z <= -7.2e+187)
		tmp = Float64(z * x);
	elseif (z <= -1.75e-28)
		tmp = t_1;
	elseif (z <= 1.8e-271)
		tmp = x;
	elseif (z <= 7500.0)
		tmp = Float64(y * t);
	elseif ((z <= 5.5e+130) || !(z <= 5.5e+282))
		tmp = Float64(z * 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 <= -7.2e+187)
		tmp = z * x;
	elseif (z <= -1.75e-28)
		tmp = t_1;
	elseif (z <= 1.8e-271)
		tmp = x;
	elseif (z <= 7500.0)
		tmp = y * t;
	elseif ((z <= 5.5e+130) || ~((z <= 5.5e+282)))
		tmp = z * 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, -7.2e+187], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.75e-28], t$95$1, If[LessEqual[z, 1.8e-271], x, If[LessEqual[z, 7500.0], N[(y * t), $MachinePrecision], If[Or[LessEqual[z, 5.5e+130], N[Not[LessEqual[z, 5.5e+282]], $MachinePrecision]], N[(z * x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.75 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{-271}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 7500:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 5.5 \cdot 10^{+130} \lor \neg \left(z \leq 5.5 \cdot 10^{+282}\right):\\
\;\;\;\;z \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -7.20000000000000072e187 or 7500 < z < 5.4999999999999997e130 or 5.4999999999999999e282 < 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 67.5%

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

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

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

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

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

    if -7.20000000000000072e187 < z < -1.75e-28 or 5.4999999999999997e130 < z < 5.4999999999999999e282

    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 74.5%

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

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

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

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

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

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

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

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

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

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

    if -1.75e-28 < z < 1.7999999999999999e-271

    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.0%

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

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

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

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

    if 1.7999999999999999e-271 < z < 7500

    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 92.0%

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

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

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

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

      \[\leadsto \color{blue}{t \cdot y} \]
    8. Step-by-step derivation
      1. *-commutative43.5%

        \[\leadsto \color{blue}{y \cdot t} \]
    9. Simplified43.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.2 \cdot 10^{+187}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-28}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-271}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 7500:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+130} \lor \neg \left(z \leq 5.5 \cdot 10^{+282}\right):\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 37.5% accurate, 0.4× speedup?

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

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

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

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

\mathbf{elif}\;z \leq 6500:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.1799999999999999e118 or 6500 < 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.8%

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

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

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

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

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

    if -1.1799999999999999e118 < z < -3.59999999999999974e-222 or 1.75000000000000009e-269 < z < 6500

    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 83.0%

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

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

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

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

      \[\leadsto \color{blue}{t \cdot y} \]
    8. Step-by-step derivation
      1. *-commutative38.3%

        \[\leadsto \color{blue}{y \cdot t} \]
    9. Simplified38.3%

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

    if -3.59999999999999974e-222 < z < 1.75000000000000009e-269

    1. Initial program 99.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.18 \cdot 10^{+118}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-222}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{-269}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6500:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 69.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{-6}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-278}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 420:\\ \;\;\;\;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 -1.35e-6)
     t_1
     (if (<= z 3.3e-278)
       (* x (- 1.0 y))
       (if (<= z 420.0) (* 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 <= -1.35e-6) {
		tmp = t_1;
	} else if (z <= 3.3e-278) {
		tmp = x * (1.0 - y);
	} else if (z <= 420.0) {
		tmp = 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 <= (-1.35d-6)) then
        tmp = t_1
    else if (z <= 3.3d-278) then
        tmp = x * (1.0d0 - y)
    else if (z <= 420.0d0) then
        tmp = 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 <= -1.35e-6) {
		tmp = t_1;
	} else if (z <= 3.3e-278) {
		tmp = x * (1.0 - y);
	} else if (z <= 420.0) {
		tmp = y * (t - x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x - t)
	tmp = 0
	if z <= -1.35e-6:
		tmp = t_1
	elif z <= 3.3e-278:
		tmp = x * (1.0 - y)
	elif z <= 420.0:
		tmp = 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 <= -1.35e-6)
		tmp = t_1;
	elseif (z <= 3.3e-278)
		tmp = Float64(x * Float64(1.0 - y));
	elseif (z <= 420.0)
		tmp = 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 <= -1.35e-6)
		tmp = t_1;
	elseif (z <= 3.3e-278)
		tmp = x * (1.0 - y);
	elseif (z <= 420.0)
		tmp = 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, -1.35e-6], t$95$1, If[LessEqual[z, 3.3e-278], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 420.0], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.34999999999999999e-6 or 420 < 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 83.2%

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

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

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

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

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

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

    if -1.34999999999999999e-6 < z < 3.2999999999999998e-278

    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.0%

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

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

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

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

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

    if 3.2999999999999998e-278 < z < 420

    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 92.1%

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

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

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

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

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

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

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

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

Alternative 5: 46.6% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+35}:\\
\;\;\;\;y \cdot t\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -9.50000000000000062e35 or 1.3e74 < 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 inf 59.9%

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

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

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

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

      \[\leadsto \color{blue}{t \cdot y} \]
    8. Step-by-step derivation
      1. *-commutative49.5%

        \[\leadsto \color{blue}{y \cdot t} \]
    9. Simplified49.5%

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

    if -9.50000000000000062e35 < t < -6.5000000000000004e-245

    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 69.9%

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

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

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

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

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

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

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

    if -6.5000000000000004e-245 < t < 1.3e74

    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 80.9%

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

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

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

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

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

Alternative 6: 50.1% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;y \leq 1.25 \cdot 10^{+168}:\\
\;\;\;\;y \cdot \left(-x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.4e44 or 1.24999999999999992e168 < y

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot y} \]
    8. Step-by-step derivation
      1. *-commutative58.4%

        \[\leadsto \color{blue}{y \cdot t} \]
    9. Simplified58.4%

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

    if -3.4e44 < y < 5.80000000000000025e23

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if 5.80000000000000025e23 < y < 1.24999999999999992e168

    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 65.3%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.4 \cdot 10^{+44}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{+23}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{+168}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 36.9% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;y \leq 5.8 \cdot 10^{+22}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 5.7 \cdot 10^{+169}:\\
\;\;\;\;y \cdot \left(-x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.90000000000000022e-63 or 5.7000000000000002e169 < y

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot y} \]
    8. Step-by-step derivation
      1. *-commutative50.9%

        \[\leadsto \color{blue}{y \cdot t} \]
    9. Simplified50.9%

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

    if -3.90000000000000022e-63 < y < 5.8e22

    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 43.9%

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

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

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

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

    if 5.8e22 < y < 5.7000000000000002e169

    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 65.3%

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

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

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

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

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

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

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

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

Alternative 8: 84.3% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.8000000000000001e54 or 1800 < 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 86.6%

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

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

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

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

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

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

    if -1.8000000000000001e54 < z < 1800

    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.0%

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

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

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

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

Alternative 9: 84.2% accurate, 0.5× speedup?

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

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

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

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


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

    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 86.3%

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

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

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

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

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

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

    if -1.1999999999999999e61 < z < 10.5

    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.0%

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

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

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

    if 10.5 < 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 86.7%

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

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

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

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

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

Alternative 10: 72.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{-6} \lor \neg \left(z \leq 1.12 \cdot 10^{-8}\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.35e-6) (not (<= z 1.12e-8))) (* z (- x t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -1.35e-6) || !(z <= 1.12e-8)) {
		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.35d-6)) .or. (.not. (z <= 1.12d-8))) 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.35e-6) || !(z <= 1.12e-8)) {
		tmp = z * (x - t);
	} else {
		tmp = x + (y * t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -1.35e-6) or not (z <= 1.12e-8):
		tmp = z * (x - t)
	else:
		tmp = x + (y * t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -1.35e-6) || !(z <= 1.12e-8))
		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.35e-6) || ~((z <= 1.12e-8)))
		tmp = z * (x - t);
	else
		tmp = x + (y * t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.35e-6], N[Not[LessEqual[z, 1.12e-8]], $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.35 \cdot 10^{-6} \lor \neg \left(z \leq 1.12 \cdot 10^{-8}\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.34999999999999999e-6 or 1.11999999999999994e-8 < 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 82.5%

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

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

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

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

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

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

    if -1.34999999999999999e-6 < z < 1.11999999999999994e-8

    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 75.8%

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

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

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

Alternative 11: 67.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -85000 \lor \neg \left(y \leq 3.8 \cdot 10^{+21}\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 -85000.0) (not (<= y 3.8e+21))) (* y (- t x)) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -85000.0) || !(y <= 3.8e+21)) {
		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 <= (-85000.0d0)) .or. (.not. (y <= 3.8d+21))) 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 <= -85000.0) || !(y <= 3.8e+21)) {
		tmp = y * (t - x);
	} else {
		tmp = x * (z + 1.0);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -85000.0) or not (y <= 3.8e+21):
		tmp = y * (t - x)
	else:
		tmp = x * (z + 1.0)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -85000.0) || !(y <= 3.8e+21))
		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 <= -85000.0) || ~((y <= 3.8e+21)))
		tmp = y * (t - x);
	else
		tmp = x * (z + 1.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -85000.0], N[Not[LessEqual[y, 3.8e+21]], $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 -85000 \lor \neg \left(y \leq 3.8 \cdot 10^{+21}\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 < -85000 or 3.8e21 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -85000 < y < 3.8e21

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

Alternative 12: 37.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -380000 \lor \neg \left(z \leq 6 \cdot 10^{-7}\right):\\
\;\;\;\;z \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.8e5 or 5.9999999999999997e-7 < 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 51.9%

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

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

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

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

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

    if -3.8e5 < z < 5.9999999999999997e-7

    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.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -380000 \lor \neg \left(z \leq 6 \cdot 10^{-7}\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: 18.2% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -82000:\\
\;\;\;\;y \cdot x\\

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


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

    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 43.5%

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

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(-y\right)} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt32.4%

        \[\leadsto x \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)} \]
      2. sqrt-unprod33.9%

        \[\leadsto x \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} \]
      3. sqr-neg33.9%

        \[\leadsto x \cdot \sqrt{\color{blue}{y \cdot y}} \]
      4. sqrt-unprod0.0%

        \[\leadsto x \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
      5. add-sqr-sqrt9.9%

        \[\leadsto x \cdot \color{blue}{y} \]
      6. pow19.9%

        \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{1}} \]
    10. Applied egg-rr9.9%

      \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{1}} \]
    11. Step-by-step derivation
      1. unpow19.9%

        \[\leadsto \color{blue}{x \cdot y} \]
    12. Simplified9.9%

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

    if -82000 < y

    1. Initial program 100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -82000:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 17.8% 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 61.6%

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

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

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

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

Developer Target 1: 96.1% 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 2024152 
(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))))