Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 7.8s
Alternatives: 13
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 13 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. Final simplification100.0%

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

Alternative 2: 54.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(-y\right)\\ t_2 := x + y \cdot t\\ \mathbf{if}\;y \leq -6.8 \cdot 10^{+135}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{+94}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{+56}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+31}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{+92} \lor \neg \left(y \leq 5 \cdot 10^{+160}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- y))) (t_2 (+ x (* y t))))
   (if (<= y -6.8e+135)
     t_1
     (if (<= y -6.2e+94)
       t_2
       (if (<= y -2.5e+56)
         t_1
         (if (<= y 1.4e+31)
           (- x (* z t))
           (if (or (<= y 8.5e+92) (not (<= y 5e+160))) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * -y;
	double t_2 = x + (y * t);
	double tmp;
	if (y <= -6.8e+135) {
		tmp = t_1;
	} else if (y <= -6.2e+94) {
		tmp = t_2;
	} else if (y <= -2.5e+56) {
		tmp = t_1;
	} else if (y <= 1.4e+31) {
		tmp = x - (z * t);
	} else if ((y <= 8.5e+92) || !(y <= 5e+160)) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * -y
    t_2 = x + (y * t)
    if (y <= (-6.8d+135)) then
        tmp = t_1
    else if (y <= (-6.2d+94)) then
        tmp = t_2
    else if (y <= (-2.5d+56)) then
        tmp = t_1
    else if (y <= 1.4d+31) then
        tmp = x - (z * t)
    else if ((y <= 8.5d+92) .or. (.not. (y <= 5d+160))) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * -y;
	double t_2 = x + (y * t);
	double tmp;
	if (y <= -6.8e+135) {
		tmp = t_1;
	} else if (y <= -6.2e+94) {
		tmp = t_2;
	} else if (y <= -2.5e+56) {
		tmp = t_1;
	} else if (y <= 1.4e+31) {
		tmp = x - (z * t);
	} else if ((y <= 8.5e+92) || !(y <= 5e+160)) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * -y
	t_2 = x + (y * t)
	tmp = 0
	if y <= -6.8e+135:
		tmp = t_1
	elif y <= -6.2e+94:
		tmp = t_2
	elif y <= -2.5e+56:
		tmp = t_1
	elif y <= 1.4e+31:
		tmp = x - (z * t)
	elif (y <= 8.5e+92) or not (y <= 5e+160):
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(-y))
	t_2 = Float64(x + Float64(y * t))
	tmp = 0.0
	if (y <= -6.8e+135)
		tmp = t_1;
	elseif (y <= -6.2e+94)
		tmp = t_2;
	elseif (y <= -2.5e+56)
		tmp = t_1;
	elseif (y <= 1.4e+31)
		tmp = Float64(x - Float64(z * t));
	elseif ((y <= 8.5e+92) || !(y <= 5e+160))
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * -y;
	t_2 = x + (y * t);
	tmp = 0.0;
	if (y <= -6.8e+135)
		tmp = t_1;
	elseif (y <= -6.2e+94)
		tmp = t_2;
	elseif (y <= -2.5e+56)
		tmp = t_1;
	elseif (y <= 1.4e+31)
		tmp = x - (z * t);
	elseif ((y <= 8.5e+92) || ~((y <= 5e+160)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * (-y)), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.8e+135], t$95$1, If[LessEqual[y, -6.2e+94], t$95$2, If[LessEqual[y, -2.5e+56], t$95$1, If[LessEqual[y, 1.4e+31], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 8.5e+92], N[Not[LessEqual[y, 5e+160]], $MachinePrecision]], t$95$1, t$95$2]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -6.2 \cdot 10^{+94}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq -2.5 \cdot 10^{+56}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;y \leq 8.5 \cdot 10^{+92} \lor \neg \left(y \leq 5 \cdot 10^{+160}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.80000000000000019e135 or -6.19999999999999983e94 < y < -2.50000000000000012e56 or 1.40000000000000008e31 < y < 8.5000000000000001e92 or 5.0000000000000002e160 < y

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

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

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

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

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

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

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

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

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

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

    if -6.80000000000000019e135 < y < -6.19999999999999983e94 or 8.5000000000000001e92 < y < 5.0000000000000002e160

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

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

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

    if -2.50000000000000012e56 < y < 1.40000000000000008e31

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

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

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

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

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

        \[\leadsto x - \color{blue}{z \cdot t} \]
    6. Simplified65.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.8 \cdot 10^{+135}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{+94}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{+56}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+31}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{+92} \lor \neg \left(y \leq 5 \cdot 10^{+160}\right):\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 65.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + y \cdot t\\ t_2 := x - z \cdot t\\ t_3 := x \cdot \left(\left(z - y\right) + 1\right)\\ \mathbf{if}\;x \leq -1.22 \cdot 10^{-98}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \leq 3.25 \cdot 10^{-305}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{-153}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-126}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-76}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* y t))) (t_2 (- x (* z t))) (t_3 (* x (+ (- z y) 1.0))))
   (if (<= x -1.22e-98)
     t_3
     (if (<= x 3.25e-305)
       t_1
       (if (<= x 6.2e-153)
         t_2
         (if (<= x 6e-126) t_1 (if (<= x 1.05e-76) t_2 t_3)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x + (y * t);
	double t_2 = x - (z * t);
	double t_3 = x * ((z - y) + 1.0);
	double tmp;
	if (x <= -1.22e-98) {
		tmp = t_3;
	} else if (x <= 3.25e-305) {
		tmp = t_1;
	} else if (x <= 6.2e-153) {
		tmp = t_2;
	} else if (x <= 6e-126) {
		tmp = t_1;
	} else if (x <= 1.05e-76) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = x + (y * t)
    t_2 = x - (z * t)
    t_3 = x * ((z - y) + 1.0d0)
    if (x <= (-1.22d-98)) then
        tmp = t_3
    else if (x <= 3.25d-305) then
        tmp = t_1
    else if (x <= 6.2d-153) then
        tmp = t_2
    else if (x <= 6d-126) then
        tmp = t_1
    else if (x <= 1.05d-76) then
        tmp = t_2
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x + (y * t);
	double t_2 = x - (z * t);
	double t_3 = x * ((z - y) + 1.0);
	double tmp;
	if (x <= -1.22e-98) {
		tmp = t_3;
	} else if (x <= 3.25e-305) {
		tmp = t_1;
	} else if (x <= 6.2e-153) {
		tmp = t_2;
	} else if (x <= 6e-126) {
		tmp = t_1;
	} else if (x <= 1.05e-76) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + (y * t)
	t_2 = x - (z * t)
	t_3 = x * ((z - y) + 1.0)
	tmp = 0
	if x <= -1.22e-98:
		tmp = t_3
	elif x <= 3.25e-305:
		tmp = t_1
	elif x <= 6.2e-153:
		tmp = t_2
	elif x <= 6e-126:
		tmp = t_1
	elif x <= 1.05e-76:
		tmp = t_2
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(y * t))
	t_2 = Float64(x - Float64(z * t))
	t_3 = Float64(x * Float64(Float64(z - y) + 1.0))
	tmp = 0.0
	if (x <= -1.22e-98)
		tmp = t_3;
	elseif (x <= 3.25e-305)
		tmp = t_1;
	elseif (x <= 6.2e-153)
		tmp = t_2;
	elseif (x <= 6e-126)
		tmp = t_1;
	elseif (x <= 1.05e-76)
		tmp = t_2;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + (y * t);
	t_2 = x - (z * t);
	t_3 = x * ((z - y) + 1.0);
	tmp = 0.0;
	if (x <= -1.22e-98)
		tmp = t_3;
	elseif (x <= 3.25e-305)
		tmp = t_1;
	elseif (x <= 6.2e-153)
		tmp = t_2;
	elseif (x <= 6e-126)
		tmp = t_1;
	elseif (x <= 1.05e-76)
		tmp = t_2;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.22e-98], t$95$3, If[LessEqual[x, 3.25e-305], t$95$1, If[LessEqual[x, 6.2e-153], t$95$2, If[LessEqual[x, 6e-126], t$95$1, If[LessEqual[x, 1.05e-76], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 3.25 \cdot 10^{-305}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 6.2 \cdot 10^{-153}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 6 \cdot 10^{-126}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.05 \cdot 10^{-76}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.2200000000000001e-98 or 1.04999999999999996e-76 < x

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

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

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

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

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

    if -1.2200000000000001e-98 < x < 3.24999999999999996e-305 or 6.1999999999999999e-153 < x < 6.0000000000000003e-126

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

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

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

    if 3.24999999999999996e-305 < x < 6.1999999999999999e-153 or 6.0000000000000003e-126 < x < 1.04999999999999996e-76

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

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

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

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

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

        \[\leadsto x - \color{blue}{z \cdot t} \]
    6. Simplified67.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.22 \cdot 10^{-98}:\\ \;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\ \mathbf{elif}\;x \leq 3.25 \cdot 10^{-305}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{-153}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-126}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-76}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 47.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(z + 1\right)\\ t_2 := x \cdot \left(-y\right)\\ t_3 := z \cdot \left(-t\right)\\ \mathbf{if}\;y \leq -1.6 \cdot 10^{+56}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -6.5 \cdot 10^{-43}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-229}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-131}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{+31}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ z 1.0))) (t_2 (* x (- y))) (t_3 (* z (- t))))
   (if (<= y -1.6e+56)
     t_2
     (if (<= y -6.5e-43)
       t_3
       (if (<= y 4e-229)
         t_1
         (if (<= y 2.3e-131) t_3 (if (<= y 1.55e+31) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (z + 1.0);
	double t_2 = x * -y;
	double t_3 = z * -t;
	double tmp;
	if (y <= -1.6e+56) {
		tmp = t_2;
	} else if (y <= -6.5e-43) {
		tmp = t_3;
	} else if (y <= 4e-229) {
		tmp = t_1;
	} else if (y <= 2.3e-131) {
		tmp = t_3;
	} else if (y <= 1.55e+31) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = x * (z + 1.0d0)
    t_2 = x * -y
    t_3 = z * -t
    if (y <= (-1.6d+56)) then
        tmp = t_2
    else if (y <= (-6.5d-43)) then
        tmp = t_3
    else if (y <= 4d-229) then
        tmp = t_1
    else if (y <= 2.3d-131) then
        tmp = t_3
    else if (y <= 1.55d+31) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (z + 1.0);
	double t_2 = x * -y;
	double t_3 = z * -t;
	double tmp;
	if (y <= -1.6e+56) {
		tmp = t_2;
	} else if (y <= -6.5e-43) {
		tmp = t_3;
	} else if (y <= 4e-229) {
		tmp = t_1;
	} else if (y <= 2.3e-131) {
		tmp = t_3;
	} else if (y <= 1.55e+31) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (z + 1.0)
	t_2 = x * -y
	t_3 = z * -t
	tmp = 0
	if y <= -1.6e+56:
		tmp = t_2
	elif y <= -6.5e-43:
		tmp = t_3
	elif y <= 4e-229:
		tmp = t_1
	elif y <= 2.3e-131:
		tmp = t_3
	elif y <= 1.55e+31:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(z + 1.0))
	t_2 = Float64(x * Float64(-y))
	t_3 = Float64(z * Float64(-t))
	tmp = 0.0
	if (y <= -1.6e+56)
		tmp = t_2;
	elseif (y <= -6.5e-43)
		tmp = t_3;
	elseif (y <= 4e-229)
		tmp = t_1;
	elseif (y <= 2.3e-131)
		tmp = t_3;
	elseif (y <= 1.55e+31)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (z + 1.0);
	t_2 = x * -y;
	t_3 = z * -t;
	tmp = 0.0;
	if (y <= -1.6e+56)
		tmp = t_2;
	elseif (y <= -6.5e-43)
		tmp = t_3;
	elseif (y <= 4e-229)
		tmp = t_1;
	elseif (y <= 2.3e-131)
		tmp = t_3;
	elseif (y <= 1.55e+31)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * (-y)), $MachinePrecision]}, Block[{t$95$3 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -1.6e+56], t$95$2, If[LessEqual[y, -6.5e-43], t$95$3, If[LessEqual[y, 4e-229], t$95$1, If[LessEqual[y, 2.3e-131], t$95$3, If[LessEqual[y, 1.55e+31], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -6.5 \cdot 10^{-43}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;y \leq 4 \cdot 10^{-229}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 2.3 \cdot 10^{-131}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;y \leq 1.55 \cdot 10^{+31}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.60000000000000002e56 or 1.5500000000000001e31 < y

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

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

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

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

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

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

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

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

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

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

    if -1.60000000000000002e56 < y < -6.50000000000000001e-43 or 4.00000000000000028e-229 < y < 2.30000000000000022e-131

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

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

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

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

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

        \[\leadsto x - \color{blue}{z \cdot t} \]
    6. Simplified71.9%

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

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

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

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

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

    if -6.50000000000000001e-43 < y < 4.00000000000000028e-229 or 2.30000000000000022e-131 < y < 1.5500000000000001e31

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.6 \cdot 10^{+56}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq -6.5 \cdot 10^{-43}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-229}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-131}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{+31}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 46.4% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t \leq 3.5 \cdot 10^{-70}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;t \leq 9.5 \cdot 10^{+78}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -6.50000000000000017e34 or 9.5000000000000006e78 < t

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

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

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

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

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

        \[\leadsto x - \color{blue}{z \cdot t} \]
    6. Simplified54.4%

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

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

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

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

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

    if -6.50000000000000017e34 < t < 3.49999999999999974e-70 or 2.0499999999999999e-10 < t < 9.5000000000000006e78

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

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

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

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

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

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

    if 3.49999999999999974e-70 < t < 2.0499999999999999e-10

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.5 \cdot 10^{+34}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{-70}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;t \leq 2.05 \cdot 10^{-10}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{+78}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 50.4% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := x + y \cdot t\\
\mathbf{if}\;t \leq -6.2 \cdot 10^{-88}:\\
\;\;\;\;t\_1\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -6.1999999999999995e-88 or 2.29999999999999991e91 < t

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

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

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

    if -6.1999999999999995e-88 < t < 3.5e-67

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

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

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

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

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

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

    if 3.5e-67 < t < 5.89999999999999981e38

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

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

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

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

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

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

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

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

    if 5.89999999999999981e38 < t < 2.29999999999999991e91

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

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

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

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

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

        \[\leadsto x - \color{blue}{z \cdot t} \]
    6. Simplified67.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.2 \cdot 10^{-88}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{-67}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;t \leq 5.9 \cdot 10^{+38}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;t \leq 2.3 \cdot 10^{+91}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 38.4% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;y \leq -4.2 \cdot 10^{-89}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq -1.26 \cdot 10^{-238}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 1.55 \cdot 10^{+31}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.4500000000000001e57 or 1.5500000000000001e31 < y

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

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

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

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

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

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

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

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

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

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

    if -1.4500000000000001e57 < y < -4.2000000000000002e-89 or -1.26000000000000004e-238 < y < 1.5500000000000001e31

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

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

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

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

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

        \[\leadsto x - \color{blue}{z \cdot t} \]
    6. Simplified65.7%

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

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

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

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

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

    if -4.2000000000000002e-89 < y < -1.26000000000000004e-238

    1. Initial program 99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.45 \cdot 10^{+57}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq -4.2 \cdot 10^{-89}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq -1.26 \cdot 10^{-238}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{+31}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 34.4% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;x \leq 1.5 \cdot 10^{+103}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.2999999999999998e92 or 1.5e103 < x

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot z} \]
    7. Step-by-step derivation
      1. *-commutative40.0%

        \[\leadsto \color{blue}{z \cdot x} \]
    8. Simplified40.0%

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

    if -4.2999999999999998e92 < x < 1.15999999999999995e42

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

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

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

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

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

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

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

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

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

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

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

    if 1.15999999999999995e42 < x < 1.5e103

    1. Initial program 99.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.3 \cdot 10^{+92}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;x \leq 1.16 \cdot 10^{+42}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;x \leq 1.5 \cdot 10^{+103}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 80.9% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.1500000000000001e-87 or 1.3e40 < t

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

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

    if -1.1500000000000001e-87 < t < 1.3e40

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

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

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

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

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

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

Alternative 10: 84.2% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.8e9 or 1.05e20 < 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 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} \]

    if -6.8e9 < y < 1.05e20

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

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

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

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

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

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

Alternative 11: 37.3% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.0000000000000002e28 or 2.2000000000000001e-6 < 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 53.2%

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot x} \]
    8. Simplified40.7%

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

    if -6.0000000000000002e28 < z < 2.2000000000000001e-6

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

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

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

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

Alternative 12: 100.0% accurate, 1.0× speedup?

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

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

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

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

Alternative 13: 18.2% 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 t around inf 62.0%

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification15.1%

    \[\leadsto x \]
  6. Add Preprocessing

Developer target: 96.2% accurate, 0.6× speedup?

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

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

Reproduce

?
herbie shell --seed 2024076 
(FPCore (x y z t)
  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
  :precision binary64

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

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