Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 8.5s
Alternatives: 14
Speedup: 1.0×

Specification

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

\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 14 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 100.0% accurate, 1.0× speedup?

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

\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}

Alternative 1: 100.0% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(y - z, t - x, x\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
	return fma((y - z), (t - x), x);
}
function code(x, y, z, t)
	return fma(Float64(y - z), Float64(t - x), x)
end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

Alternative 2: 37.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{+17}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{-104}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{-265}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{-306}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 4.7 \cdot 10^{-298}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-258}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 3 \cdot 10^{-167}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+59}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -9.5e+17)
   (* z x)
   (if (<= z -3.9e-104)
     (* y t)
     (if (<= z -1.05e-265)
       x
       (if (<= z -5.8e-306)
         (* y (- x))
         (if (<= z 4.7e-298)
           x
           (if (<= z 4.8e-258)
             (* y t)
             (if (<= z 3e-167) x (if (<= z 1.9e+59) (* y t) (* z x))))))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -9.5e+17) {
		tmp = z * x;
	} else if (z <= -3.9e-104) {
		tmp = y * t;
	} else if (z <= -1.05e-265) {
		tmp = x;
	} else if (z <= -5.8e-306) {
		tmp = y * -x;
	} else if (z <= 4.7e-298) {
		tmp = x;
	} else if (z <= 4.8e-258) {
		tmp = y * t;
	} else if (z <= 3e-167) {
		tmp = x;
	} else if (z <= 1.9e+59) {
		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 <= (-9.5d+17)) then
        tmp = z * x
    else if (z <= (-3.9d-104)) then
        tmp = y * t
    else if (z <= (-1.05d-265)) then
        tmp = x
    else if (z <= (-5.8d-306)) then
        tmp = y * -x
    else if (z <= 4.7d-298) then
        tmp = x
    else if (z <= 4.8d-258) then
        tmp = y * t
    else if (z <= 3d-167) then
        tmp = x
    else if (z <= 1.9d+59) 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 <= -9.5e+17) {
		tmp = z * x;
	} else if (z <= -3.9e-104) {
		tmp = y * t;
	} else if (z <= -1.05e-265) {
		tmp = x;
	} else if (z <= -5.8e-306) {
		tmp = y * -x;
	} else if (z <= 4.7e-298) {
		tmp = x;
	} else if (z <= 4.8e-258) {
		tmp = y * t;
	} else if (z <= 3e-167) {
		tmp = x;
	} else if (z <= 1.9e+59) {
		tmp = y * t;
	} else {
		tmp = z * x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -9.5e+17:
		tmp = z * x
	elif z <= -3.9e-104:
		tmp = y * t
	elif z <= -1.05e-265:
		tmp = x
	elif z <= -5.8e-306:
		tmp = y * -x
	elif z <= 4.7e-298:
		tmp = x
	elif z <= 4.8e-258:
		tmp = y * t
	elif z <= 3e-167:
		tmp = x
	elif z <= 1.9e+59:
		tmp = y * t
	else:
		tmp = z * x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -9.5e+17)
		tmp = Float64(z * x);
	elseif (z <= -3.9e-104)
		tmp = Float64(y * t);
	elseif (z <= -1.05e-265)
		tmp = x;
	elseif (z <= -5.8e-306)
		tmp = Float64(y * Float64(-x));
	elseif (z <= 4.7e-298)
		tmp = x;
	elseif (z <= 4.8e-258)
		tmp = Float64(y * t);
	elseif (z <= 3e-167)
		tmp = x;
	elseif (z <= 1.9e+59)
		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 <= -9.5e+17)
		tmp = z * x;
	elseif (z <= -3.9e-104)
		tmp = y * t;
	elseif (z <= -1.05e-265)
		tmp = x;
	elseif (z <= -5.8e-306)
		tmp = y * -x;
	elseif (z <= 4.7e-298)
		tmp = x;
	elseif (z <= 4.8e-258)
		tmp = y * t;
	elseif (z <= 3e-167)
		tmp = x;
	elseif (z <= 1.9e+59)
		tmp = y * t;
	else
		tmp = z * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -9.5e+17], N[(z * x), $MachinePrecision], If[LessEqual[z, -3.9e-104], N[(y * t), $MachinePrecision], If[LessEqual[z, -1.05e-265], x, If[LessEqual[z, -5.8e-306], N[(y * (-x)), $MachinePrecision], If[LessEqual[z, 4.7e-298], x, If[LessEqual[z, 4.8e-258], N[(y * t), $MachinePrecision], If[LessEqual[z, 3e-167], x, If[LessEqual[z, 1.9e+59], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -3.9 \cdot 10^{-104}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq -1.05 \cdot 10^{-265}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq -5.8 \cdot 10^{-306}:\\
\;\;\;\;y \cdot \left(-x\right)\\

\mathbf{elif}\;z \leq 4.7 \cdot 10^{-298}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 4.8 \cdot 10^{-258}:\\
\;\;\;\;y \cdot t\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -9.5e17 or 1.9e59 < z

    1. Initial program 99.9%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+57.8%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)} \]
      7. neg-sub057.8%

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg57.8%

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

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

      \[\leadsto \color{blue}{x + x \cdot z} \]
    6. Step-by-step derivation
      1. *-commutative49.3%

        \[\leadsto x + \color{blue}{z \cdot x} \]
    7. Simplified49.3%

      \[\leadsto \color{blue}{x + z \cdot x} \]
    8. Taylor expanded in z around inf 49.3%

      \[\leadsto \color{blue}{x \cdot z} \]
    9. Step-by-step derivation
      1. *-commutative49.3%

        \[\leadsto \color{blue}{z \cdot x} \]
    10. Simplified49.3%

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

    if -9.5e17 < z < -3.9000000000000002e-104 or 4.70000000000000037e-298 < z < 4.8000000000000003e-258 or 2.9999999999999998e-167 < z < 1.9e59

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.9000000000000002e-104 < z < -1.05000000000000002e-265 or -5.7999999999999998e-306 < z < 4.70000000000000037e-298 or 4.8000000000000003e-258 < z < 2.9999999999999998e-167

    1. Initial program 100.0%

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

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

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

    if -1.05000000000000002e-265 < z < -5.7999999999999998e-306

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+82.3%

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

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg82.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{+17}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{-104}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{-265}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{-306}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 4.7 \cdot 10^{-298}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-258}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 3 \cdot 10^{-167}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+59}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]

Alternative 3: 51.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(1 - y\right)\\ t_2 := y \cdot \left(t - x\right)\\ \mathbf{if}\;z \leq -2.25 \cdot 10^{+136}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -2 \cdot 10^{-104}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-298}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.06 \cdot 10^{-259}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-166}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{+119}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- 1.0 y))) (t_2 (* y (- t x))))
   (if (<= z -2.25e+136)
     (* z x)
     (if (<= z -2e-104)
       t_2
       (if (<= z 3.2e-298)
         t_1
         (if (<= z 1.06e-259)
           t_2
           (if (<= z 5e-166) t_1 (if (<= z 2.55e+119) t_2 (* z x)))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - y);
	double t_2 = y * (t - x);
	double tmp;
	if (z <= -2.25e+136) {
		tmp = z * x;
	} else if (z <= -2e-104) {
		tmp = t_2;
	} else if (z <= 3.2e-298) {
		tmp = t_1;
	} else if (z <= 1.06e-259) {
		tmp = t_2;
	} else if (z <= 5e-166) {
		tmp = t_1;
	} else if (z <= 2.55e+119) {
		tmp = t_2;
	} else {
		tmp = z * x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * (1.0d0 - y)
    t_2 = y * (t - x)
    if (z <= (-2.25d+136)) then
        tmp = z * x
    else if (z <= (-2d-104)) then
        tmp = t_2
    else if (z <= 3.2d-298) then
        tmp = t_1
    else if (z <= 1.06d-259) then
        tmp = t_2
    else if (z <= 5d-166) then
        tmp = t_1
    else if (z <= 2.55d+119) then
        tmp = t_2
    else
        tmp = z * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - y);
	double t_2 = y * (t - x);
	double tmp;
	if (z <= -2.25e+136) {
		tmp = z * x;
	} else if (z <= -2e-104) {
		tmp = t_2;
	} else if (z <= 3.2e-298) {
		tmp = t_1;
	} else if (z <= 1.06e-259) {
		tmp = t_2;
	} else if (z <= 5e-166) {
		tmp = t_1;
	} else if (z <= 2.55e+119) {
		tmp = t_2;
	} else {
		tmp = z * x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (1.0 - y)
	t_2 = y * (t - x)
	tmp = 0
	if z <= -2.25e+136:
		tmp = z * x
	elif z <= -2e-104:
		tmp = t_2
	elif z <= 3.2e-298:
		tmp = t_1
	elif z <= 1.06e-259:
		tmp = t_2
	elif z <= 5e-166:
		tmp = t_1
	elif z <= 2.55e+119:
		tmp = t_2
	else:
		tmp = z * x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(1.0 - y))
	t_2 = Float64(y * Float64(t - x))
	tmp = 0.0
	if (z <= -2.25e+136)
		tmp = Float64(z * x);
	elseif (z <= -2e-104)
		tmp = t_2;
	elseif (z <= 3.2e-298)
		tmp = t_1;
	elseif (z <= 1.06e-259)
		tmp = t_2;
	elseif (z <= 5e-166)
		tmp = t_1;
	elseif (z <= 2.55e+119)
		tmp = t_2;
	else
		tmp = Float64(z * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (1.0 - y);
	t_2 = y * (t - x);
	tmp = 0.0;
	if (z <= -2.25e+136)
		tmp = z * x;
	elseif (z <= -2e-104)
		tmp = t_2;
	elseif (z <= 3.2e-298)
		tmp = t_1;
	elseif (z <= 1.06e-259)
		tmp = t_2;
	elseif (z <= 5e-166)
		tmp = t_1;
	elseif (z <= 2.55e+119)
		tmp = t_2;
	else
		tmp = z * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.25e+136], N[(z * x), $MachinePrecision], If[LessEqual[z, -2e-104], t$95$2, If[LessEqual[z, 3.2e-298], t$95$1, If[LessEqual[z, 1.06e-259], t$95$2, If[LessEqual[z, 5e-166], t$95$1, If[LessEqual[z, 2.55e+119], t$95$2, N[(z * x), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2 \cdot 10^{-104}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 3.2 \cdot 10^{-298}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1.06 \cdot 10^{-259}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 5 \cdot 10^{-166}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 2.55 \cdot 10^{+119}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.25e136 or 2.54999999999999992e119 < z

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+61.2%

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

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg61.2%

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

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

      \[\leadsto \color{blue}{x + x \cdot z} \]
    6. Step-by-step derivation
      1. *-commutative56.4%

        \[\leadsto x + \color{blue}{z \cdot x} \]
    7. Simplified56.4%

      \[\leadsto \color{blue}{x + z \cdot x} \]
    8. Taylor expanded in z around inf 56.4%

      \[\leadsto \color{blue}{x \cdot z} \]
    9. Step-by-step derivation
      1. *-commutative56.4%

        \[\leadsto \color{blue}{z \cdot x} \]
    10. Simplified56.4%

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

    if -2.25e136 < z < -1.99999999999999985e-104 or 3.19999999999999997e-298 < z < 1.06e-259 or 5e-166 < z < 2.54999999999999992e119

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999985e-104 < z < 3.19999999999999997e-298 or 1.06e-259 < z < 5e-166

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+79.0%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)} \]
      7. neg-sub079.0%

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg79.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.25 \cdot 10^{+136}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -2 \cdot 10^{-104}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-298}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 1.06 \cdot 10^{-259}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-166}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{+119}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]

Alternative 4: 37.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -52000000000:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-103}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-298}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-258}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-164}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+56}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -52000000000.0)
   (* z x)
   (if (<= z -1.2e-103)
     (* y t)
     (if (<= z 1.25e-298)
       x
       (if (<= z 7.5e-258)
         (* y t)
         (if (<= z 1.25e-164) x (if (<= z 4.2e+56) (* y t) (* z x))))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -52000000000.0) {
		tmp = z * x;
	} else if (z <= -1.2e-103) {
		tmp = y * t;
	} else if (z <= 1.25e-298) {
		tmp = x;
	} else if (z <= 7.5e-258) {
		tmp = y * t;
	} else if (z <= 1.25e-164) {
		tmp = x;
	} else if (z <= 4.2e+56) {
		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 <= (-52000000000.0d0)) then
        tmp = z * x
    else if (z <= (-1.2d-103)) then
        tmp = y * t
    else if (z <= 1.25d-298) then
        tmp = x
    else if (z <= 7.5d-258) then
        tmp = y * t
    else if (z <= 1.25d-164) then
        tmp = x
    else if (z <= 4.2d+56) 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 <= -52000000000.0) {
		tmp = z * x;
	} else if (z <= -1.2e-103) {
		tmp = y * t;
	} else if (z <= 1.25e-298) {
		tmp = x;
	} else if (z <= 7.5e-258) {
		tmp = y * t;
	} else if (z <= 1.25e-164) {
		tmp = x;
	} else if (z <= 4.2e+56) {
		tmp = y * t;
	} else {
		tmp = z * x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -52000000000.0:
		tmp = z * x
	elif z <= -1.2e-103:
		tmp = y * t
	elif z <= 1.25e-298:
		tmp = x
	elif z <= 7.5e-258:
		tmp = y * t
	elif z <= 1.25e-164:
		tmp = x
	elif z <= 4.2e+56:
		tmp = y * t
	else:
		tmp = z * x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -52000000000.0)
		tmp = Float64(z * x);
	elseif (z <= -1.2e-103)
		tmp = Float64(y * t);
	elseif (z <= 1.25e-298)
		tmp = x;
	elseif (z <= 7.5e-258)
		tmp = Float64(y * t);
	elseif (z <= 1.25e-164)
		tmp = x;
	elseif (z <= 4.2e+56)
		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 <= -52000000000.0)
		tmp = z * x;
	elseif (z <= -1.2e-103)
		tmp = y * t;
	elseif (z <= 1.25e-298)
		tmp = x;
	elseif (z <= 7.5e-258)
		tmp = y * t;
	elseif (z <= 1.25e-164)
		tmp = x;
	elseif (z <= 4.2e+56)
		tmp = y * t;
	else
		tmp = z * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -52000000000.0], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.2e-103], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.25e-298], x, If[LessEqual[z, 7.5e-258], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.25e-164], x, If[LessEqual[z, 4.2e+56], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.2 \cdot 10^{-103}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 1.25 \cdot 10^{-298}:\\
\;\;\;\;x\\

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

\mathbf{elif}\;z \leq 1.25 \cdot 10^{-164}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.2e10 or 4.20000000000000034e56 < z

    1. Initial program 99.9%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+57.8%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)} \]
      7. neg-sub057.8%

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg57.8%

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

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

      \[\leadsto \color{blue}{x + x \cdot z} \]
    6. Step-by-step derivation
      1. *-commutative49.3%

        \[\leadsto x + \color{blue}{z \cdot x} \]
    7. Simplified49.3%

      \[\leadsto \color{blue}{x + z \cdot x} \]
    8. Taylor expanded in z around inf 49.3%

      \[\leadsto \color{blue}{x \cdot z} \]
    9. Step-by-step derivation
      1. *-commutative49.3%

        \[\leadsto \color{blue}{z \cdot x} \]
    10. Simplified49.3%

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

    if -5.2e10 < z < -1.2000000000000001e-103 or 1.25000000000000005e-298 < z < 7.4999999999999998e-258 or 1.2499999999999999e-164 < z < 4.20000000000000034e56

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.2000000000000001e-103 < z < 1.25000000000000005e-298 or 7.4999999999999998e-258 < z < 1.2499999999999999e-164

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -52000000000:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-103}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-298}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-258}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-164}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+56}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]

Alternative 5: 69.7% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;y \leq -3.8 \cdot 10^{-254}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq 1.15 \cdot 10^{-206}:\\
\;\;\;\;x - z \cdot t\\

\mathbf{elif}\;y \leq 0.06:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.99999999999999985e-24 or 0.059999999999999998 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999985e-24 < y < -3.8000000000000001e-254 or 1.15e-206 < y < 0.059999999999999998

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+70.5%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)} \]
      7. neg-sub070.5%

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg70.5%

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

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

      \[\leadsto \color{blue}{x + x \cdot z} \]
    6. Step-by-step derivation
      1. *-commutative70.5%

        \[\leadsto x + \color{blue}{z \cdot x} \]
    7. Simplified70.5%

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

    if -3.8000000000000001e-254 < y < 1.15e-206

    1. Initial program 100.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-24}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -3.8 \cdot 10^{-254}:\\ \;\;\;\;x + z \cdot x\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{-206}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 0.06:\\ \;\;\;\;x + z \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 6: 58.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{-42}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1 \cdot 10^{-145}:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;y \leq 3.6 \cdot 10^{-12}:\\
\;\;\;\;x + y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.5e-42 or 3.6e-12 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.5e-42 < y < -9.99999999999999915e-146

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+74.1%

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

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg74.1%

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

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

      \[\leadsto \color{blue}{x + x \cdot z} \]
    6. Step-by-step derivation
      1. *-commutative74.1%

        \[\leadsto x + \color{blue}{z \cdot x} \]
    7. Simplified74.1%

      \[\leadsto \color{blue}{x + z \cdot x} \]
    8. Taylor expanded in z around inf 54.8%

      \[\leadsto \color{blue}{x \cdot z} \]
    9. Step-by-step derivation
      1. *-commutative54.8%

        \[\leadsto \color{blue}{z \cdot x} \]
    10. Simplified54.8%

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

    if -9.99999999999999915e-146 < y < 3.6e-12

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{-42}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-145}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-12}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 7: 77.3% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -14 or 1.24999999999999989e28 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot y - x \cdot \left(y - 1\right)} \]
      4. sub-neg78.3%

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

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

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

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

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

    if -14 < y < 1.24999999999999989e28

    1. Initial program 100.0%

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

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

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

Alternative 8: 81.1% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.50000000000000005e-54 or 1.15e-48 < t

    1. Initial program 100.0%

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

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

    if -1.50000000000000005e-54 < t < 1.15e-48

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+84.1%

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

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg84.1%

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

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

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

Alternative 9: 84.0% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \lor \neg \left(z \leq 3.2 \cdot 10^{+54}\right):\\
\;\;\;\;x + 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 < -3.39999999999999991 or 3.2e54 < z

    1. Initial program 99.9%

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

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

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

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

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

    if -3.39999999999999991 < z < 3.2e54

    1. Initial program 100.0%

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

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

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

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

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

Alternative 10: 49.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -220 \lor \neg \left(z \leq 5.4 \cdot 10^{+118}\right):\\
\;\;\;\;z \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -220 or 5.4e118 < z

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+58.9%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)} \]
      7. neg-sub058.9%

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg58.9%

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

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

      \[\leadsto \color{blue}{x + x \cdot z} \]
    6. Step-by-step derivation
      1. *-commutative51.3%

        \[\leadsto x + \color{blue}{z \cdot x} \]
    7. Simplified51.3%

      \[\leadsto \color{blue}{x + z \cdot x} \]
    8. Taylor expanded in z around inf 51.3%

      \[\leadsto \color{blue}{x \cdot z} \]
    9. Step-by-step derivation
      1. *-commutative51.3%

        \[\leadsto \color{blue}{z \cdot x} \]
    10. Simplified51.3%

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

    if -220 < z < 5.4e118

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+60.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 68.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{-18} \lor \neg \left(y \leq 0.0012\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.39999999999999994e-18 or 0.00119999999999999989 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.39999999999999994e-18 < y < 0.00119999999999999989

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+65.1%

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

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg65.1%

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

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

      \[\leadsto \color{blue}{x + x \cdot z} \]
    6. Step-by-step derivation
      1. *-commutative65.1%

        \[\leadsto x + \color{blue}{z \cdot x} \]
    7. Simplified65.1%

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

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

Alternative 12: 100.0% accurate, 1.0× speedup?

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

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

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

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

Alternative 13: 37.6% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-39} \lor \neg \left(y \leq 3.1 \cdot 10^{-12}\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.1999999999999998e-39 or 3.1000000000000001e-12 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.1999999999999998e-39 < y < 3.1000000000000001e-12

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-39} \lor \neg \left(y \leq 3.1 \cdot 10^{-12}\right):\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 14: 17.9% accurate, 9.0× speedup?

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

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

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

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

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

    \[\leadsto x \]

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

  :herbie-target
  (+ x (+ (* t (- y z)) (* (- x) (- y z))))

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