Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 7.6s
Alternatives: 12
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 12 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, 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 2: 82.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ t_2 := x + t \cdot \left(y - z\right)\\ \mathbf{if}\;y \leq -9.2 \cdot 10^{+108}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.2 \cdot 10^{-29}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.56 \cdot 10^{-34}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+77}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+122}:\\ \;\;\;\;x + x \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;x + t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (- t x))) (t_2 (+ x (* t (- y z)))))
   (if (<= y -9.2e+108)
     t_1
     (if (<= y -1.2e-29)
       t_2
       (if (<= y 1.56e-34)
         (+ x (* z (- x t)))
         (if (<= y 1.9e+77)
           t_2
           (if (<= y 2.8e+122) (+ x (* x (- z y))) (+ x t_1))))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double t_2 = x + (t * (y - z));
	double tmp;
	if (y <= -9.2e+108) {
		tmp = t_1;
	} else if (y <= -1.2e-29) {
		tmp = t_2;
	} else if (y <= 1.56e-34) {
		tmp = x + (z * (x - t));
	} else if (y <= 1.9e+77) {
		tmp = t_2;
	} else if (y <= 2.8e+122) {
		tmp = x + (x * (z - y));
	} else {
		tmp = x + t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = y * (t - x)
    t_2 = x + (t * (y - z))
    if (y <= (-9.2d+108)) then
        tmp = t_1
    else if (y <= (-1.2d-29)) then
        tmp = t_2
    else if (y <= 1.56d-34) then
        tmp = x + (z * (x - t))
    else if (y <= 1.9d+77) then
        tmp = t_2
    else if (y <= 2.8d+122) then
        tmp = x + (x * (z - y))
    else
        tmp = x + t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double t_2 = x + (t * (y - z));
	double tmp;
	if (y <= -9.2e+108) {
		tmp = t_1;
	} else if (y <= -1.2e-29) {
		tmp = t_2;
	} else if (y <= 1.56e-34) {
		tmp = x + (z * (x - t));
	} else if (y <= 1.9e+77) {
		tmp = t_2;
	} else if (y <= 2.8e+122) {
		tmp = x + (x * (z - y));
	} else {
		tmp = x + t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t - x)
	t_2 = x + (t * (y - z))
	tmp = 0
	if y <= -9.2e+108:
		tmp = t_1
	elif y <= -1.2e-29:
		tmp = t_2
	elif y <= 1.56e-34:
		tmp = x + (z * (x - t))
	elif y <= 1.9e+77:
		tmp = t_2
	elif y <= 2.8e+122:
		tmp = x + (x * (z - y))
	else:
		tmp = x + t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(t - x))
	t_2 = Float64(x + Float64(t * Float64(y - z)))
	tmp = 0.0
	if (y <= -9.2e+108)
		tmp = t_1;
	elseif (y <= -1.2e-29)
		tmp = t_2;
	elseif (y <= 1.56e-34)
		tmp = Float64(x + Float64(z * Float64(x - t)));
	elseif (y <= 1.9e+77)
		tmp = t_2;
	elseif (y <= 2.8e+122)
		tmp = Float64(x + Float64(x * Float64(z - y)));
	else
		tmp = Float64(x + t_1);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (t - x);
	t_2 = x + (t * (y - z));
	tmp = 0.0;
	if (y <= -9.2e+108)
		tmp = t_1;
	elseif (y <= -1.2e-29)
		tmp = t_2;
	elseif (y <= 1.56e-34)
		tmp = x + (z * (x - t));
	elseif (y <= 1.9e+77)
		tmp = t_2;
	elseif (y <= 2.8e+122)
		tmp = x + (x * (z - y));
	else
		tmp = x + 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[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.2e+108], t$95$1, If[LessEqual[y, -1.2e-29], t$95$2, If[LessEqual[y, 1.56e-34], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+77], t$95$2, If[LessEqual[y, 2.8e+122], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -1.2 \cdot 10^{-29}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;y \leq 1.9 \cdot 10^{+77}:\\
\;\;\;\;t_2\\

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.1999999999999996e108 < y < -1.19999999999999996e-29 or 1.55999999999999992e-34 < y < 1.9000000000000001e77

    1. Initial program 100.0%

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

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

    if -1.19999999999999996e-29 < y < 1.55999999999999992e-34

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if 1.9000000000000001e77 < y < 2.8e122

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.8e122 < y

    1. Initial program 99.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.2 \cdot 10^{+108}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -1.2 \cdot 10^{-29}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \mathbf{elif}\;y \leq 1.56 \cdot 10^{-34}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+77}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+122}:\\ \;\;\;\;x + x \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 3: 68.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ t_2 := z \cdot \left(x - t\right)\\ t_3 := x \cdot \left(1 - y\right)\\ \mathbf{if}\;z \leq -6.2 \cdot 10^{-5}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -5.1 \cdot 10^{-253}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-286}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-170}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+17}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (- t x))) (t_2 (* z (- x t))) (t_3 (* x (- 1.0 y))))
   (if (<= z -6.2e-5)
     t_2
     (if (<= z -5.1e-253)
       t_3
       (if (<= z 6e-286)
         t_1
         (if (<= z 5.5e-170) t_3 (if (<= z 6e+17) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double t_2 = z * (x - t);
	double t_3 = x * (1.0 - y);
	double tmp;
	if (z <= -6.2e-5) {
		tmp = t_2;
	} else if (z <= -5.1e-253) {
		tmp = t_3;
	} else if (z <= 6e-286) {
		tmp = t_1;
	} else if (z <= 5.5e-170) {
		tmp = t_3;
	} else if (z <= 6e+17) {
		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 = y * (t - x)
    t_2 = z * (x - t)
    t_3 = x * (1.0d0 - y)
    if (z <= (-6.2d-5)) then
        tmp = t_2
    else if (z <= (-5.1d-253)) then
        tmp = t_3
    else if (z <= 6d-286) then
        tmp = t_1
    else if (z <= 5.5d-170) then
        tmp = t_3
    else if (z <= 6d+17) 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 = y * (t - x);
	double t_2 = z * (x - t);
	double t_3 = x * (1.0 - y);
	double tmp;
	if (z <= -6.2e-5) {
		tmp = t_2;
	} else if (z <= -5.1e-253) {
		tmp = t_3;
	} else if (z <= 6e-286) {
		tmp = t_1;
	} else if (z <= 5.5e-170) {
		tmp = t_3;
	} else if (z <= 6e+17) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t - x)
	t_2 = z * (x - t)
	t_3 = x * (1.0 - y)
	tmp = 0
	if z <= -6.2e-5:
		tmp = t_2
	elif z <= -5.1e-253:
		tmp = t_3
	elif z <= 6e-286:
		tmp = t_1
	elif z <= 5.5e-170:
		tmp = t_3
	elif z <= 6e+17:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(t - x))
	t_2 = Float64(z * Float64(x - t))
	t_3 = Float64(x * Float64(1.0 - y))
	tmp = 0.0
	if (z <= -6.2e-5)
		tmp = t_2;
	elseif (z <= -5.1e-253)
		tmp = t_3;
	elseif (z <= 6e-286)
		tmp = t_1;
	elseif (z <= 5.5e-170)
		tmp = t_3;
	elseif (z <= 6e+17)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (t - x);
	t_2 = z * (x - t);
	t_3 = x * (1.0 - y);
	tmp = 0.0;
	if (z <= -6.2e-5)
		tmp = t_2;
	elseif (z <= -5.1e-253)
		tmp = t_3;
	elseif (z <= 6e-286)
		tmp = t_1;
	elseif (z <= 5.5e-170)
		tmp = t_3;
	elseif (z <= 6e+17)
		tmp = t_1;
	else
		tmp = t_2;
	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[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.2e-5], t$95$2, If[LessEqual[z, -5.1e-253], t$95$3, If[LessEqual[z, 6e-286], t$95$1, If[LessEqual[z, 5.5e-170], t$95$3, If[LessEqual[z, 6e+17], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -5.1 \cdot 10^{-253}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 6 \cdot 10^{-286}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 5.5 \cdot 10^{-170}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 6 \cdot 10^{+17}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.20000000000000027e-5 or 6e17 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if -6.20000000000000027e-5 < z < -5.10000000000000008e-253 or 6.0000000000000001e-286 < z < 5.50000000000000018e-170

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -5.10000000000000008e-253 < z < 6.0000000000000001e-286 or 5.50000000000000018e-170 < z < 6e17

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.2 \cdot 10^{-5}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq -5.1 \cdot 10^{-253}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-286}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-170}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+17}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 4: 71.6% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;z \leq 7.6 \cdot 10^{-287}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;z \leq 1.55 \cdot 10^{-102}:\\
\;\;\;\;t_2\\

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if -70 < z < 7.59999999999999964e-287 or 1.4500000000000001e-186 < z < 1.55000000000000006e-102

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto x + \color{blue}{t \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative79.2%

        \[\leadsto x + \color{blue}{y \cdot t} \]
    7. Simplified79.2%

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

    if 7.59999999999999964e-287 < z < 1.4500000000000001e-186

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if 1.55000000000000006e-102 < z < 2.65e17

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -70:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{-287}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-186}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-102}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{+17}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 5: 76.1% accurate, 0.8× speedup?

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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.1999999999999996e108 < y < 2.2e52

    1. Initial program 100.0%

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

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

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

Alternative 6: 81.9% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.9499999999999999e-14 or 1.24999999999999998e66 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9499999999999999e-14 < x < 1.24999999999999998e66

    1. Initial program 100.0%

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

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

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

Alternative 7: 81.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.4e6 or 1.7e130 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if -4.4e6 < z < 1.7e130

    1. Initial program 100.0%

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

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

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

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

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

Alternative 8: 55.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00048 \lor \neg \left(y \leq 3000000\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.80000000000000012e-4 or 3e6 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.80000000000000012e-4 < y < 3e6

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.00048 \lor \neg \left(y \leq 3000000\right):\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \end{array} \]

Alternative 9: 72.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1960 \lor \neg \left(y \leq 170000\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1960 or 1.7e5 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1960 < y < 1.7e5

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1960 \lor \neg \left(y \leq 170000\right):\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot t\\ \end{array} \]

Alternative 10: 37.0% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -760 \lor \neg \left(y \leq 0.66\right):\\
\;\;\;\;y \cdot \left(-x\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-x \cdot y} \]
      2. distribute-rgt-neg-out40.5%

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

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

    if -760 < y < 0.660000000000000031

    1. Initial program 100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -760 \lor \neg \left(y \leq 0.66\right):\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 11: 37.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ x \cdot \left(1 - y\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* x (- 1.0 y)))
double code(double x, double y, double z, double t) {
	return x * (1.0 - y);
}
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 * (1.0d0 - y)
end function
public static double code(double x, double y, double z, double t) {
	return x * (1.0 - y);
}
def code(x, y, z, t):
	return x * (1.0 - y)
function code(x, y, z, t)
	return Float64(x * Float64(1.0 - y))
end
function tmp = code(x, y, z, t)
	tmp = x * (1.0 - y);
end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

    \[\leadsto x \cdot \left(1 - y\right) \]

Alternative 12: 18.1% 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 y around inf 63.4%

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

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

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

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

    \[\leadsto x \]

Developer target: 96.9% 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 2023318 
(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))))