Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 8.7s
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: 70.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + z \cdot x\\ t_2 := y \cdot \left(t - x\right)\\ t_3 := x - z \cdot t\\ \mathbf{if}\;y \leq -80000000000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -8.5 \cdot 10^{-47}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq -2.6 \cdot 10^{-213}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{-283}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-229}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 48000:\\ \;\;\;\;t\_3\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* z x))) (t_2 (* y (- t x))) (t_3 (- x (* z t))))
   (if (<= y -80000000000000.0)
     t_2
     (if (<= y -8.5e-47)
       (* z (- x t))
       (if (<= y -2.6e-213)
         t_1
         (if (<= y 8.2e-283)
           t_3
           (if (<= y 5e-229) t_1 (if (<= y 48000.0) t_3 t_2))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x + (z * x);
	double t_2 = y * (t - x);
	double t_3 = x - (z * t);
	double tmp;
	if (y <= -80000000000000.0) {
		tmp = t_2;
	} else if (y <= -8.5e-47) {
		tmp = z * (x - t);
	} else if (y <= -2.6e-213) {
		tmp = t_1;
	} else if (y <= 8.2e-283) {
		tmp = t_3;
	} else if (y <= 5e-229) {
		tmp = t_1;
	} else if (y <= 48000.0) {
		tmp = t_3;
	} 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 * x)
    t_2 = y * (t - x)
    t_3 = x - (z * t)
    if (y <= (-80000000000000.0d0)) then
        tmp = t_2
    else if (y <= (-8.5d-47)) then
        tmp = z * (x - t)
    else if (y <= (-2.6d-213)) then
        tmp = t_1
    else if (y <= 8.2d-283) then
        tmp = t_3
    else if (y <= 5d-229) then
        tmp = t_1
    else if (y <= 48000.0d0) then
        tmp = t_3
    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 * x);
	double t_2 = y * (t - x);
	double t_3 = x - (z * t);
	double tmp;
	if (y <= -80000000000000.0) {
		tmp = t_2;
	} else if (y <= -8.5e-47) {
		tmp = z * (x - t);
	} else if (y <= -2.6e-213) {
		tmp = t_1;
	} else if (y <= 8.2e-283) {
		tmp = t_3;
	} else if (y <= 5e-229) {
		tmp = t_1;
	} else if (y <= 48000.0) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + (z * x)
	t_2 = y * (t - x)
	t_3 = x - (z * t)
	tmp = 0
	if y <= -80000000000000.0:
		tmp = t_2
	elif y <= -8.5e-47:
		tmp = z * (x - t)
	elif y <= -2.6e-213:
		tmp = t_1
	elif y <= 8.2e-283:
		tmp = t_3
	elif y <= 5e-229:
		tmp = t_1
	elif y <= 48000.0:
		tmp = t_3
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(z * x))
	t_2 = Float64(y * Float64(t - x))
	t_3 = Float64(x - Float64(z * t))
	tmp = 0.0
	if (y <= -80000000000000.0)
		tmp = t_2;
	elseif (y <= -8.5e-47)
		tmp = Float64(z * Float64(x - t));
	elseif (y <= -2.6e-213)
		tmp = t_1;
	elseif (y <= 8.2e-283)
		tmp = t_3;
	elseif (y <= 5e-229)
		tmp = t_1;
	elseif (y <= 48000.0)
		tmp = t_3;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + (z * x);
	t_2 = y * (t - x);
	t_3 = x - (z * t);
	tmp = 0.0;
	if (y <= -80000000000000.0)
		tmp = t_2;
	elseif (y <= -8.5e-47)
		tmp = z * (x - t);
	elseif (y <= -2.6e-213)
		tmp = t_1;
	elseif (y <= 8.2e-283)
		tmp = t_3;
	elseif (y <= 5e-229)
		tmp = t_1;
	elseif (y <= 48000.0)
		tmp = t_3;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -80000000000000.0], t$95$2, If[LessEqual[y, -8.5e-47], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.6e-213], t$95$1, If[LessEqual[y, 8.2e-283], t$95$3, If[LessEqual[y, 5e-229], t$95$1, If[LessEqual[y, 48000.0], t$95$3, t$95$2]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq -2.6 \cdot 10^{-213}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 8.2 \cdot 10^{-283}:\\
\;\;\;\;t\_3\\

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

\mathbf{elif}\;y \leq 48000:\\
\;\;\;\;t\_3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -8e13 or 48000 < 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.6%

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

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

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

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

    if -8e13 < y < -8.4999999999999999e-47

    1. Initial program 100.0%

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

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

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

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

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

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

    if -8.4999999999999999e-47 < y < -2.6000000000000001e-213 or 8.19999999999999973e-283 < y < 5.00000000000000016e-229

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.6000000000000001e-213 < y < 8.19999999999999973e-283 or 5.00000000000000016e-229 < y < 48000

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -80000000000000:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -8.5 \cdot 10^{-47}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq -2.6 \cdot 10^{-213}:\\ \;\;\;\;x + z \cdot x\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{-283}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-229}:\\ \;\;\;\;x + z \cdot x\\ \mathbf{elif}\;y \leq 48000:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 68.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(1 - y\right)\\ t_2 := z \cdot \left(x - t\right)\\ t_3 := y \cdot \left(t - x\right)\\ \mathbf{if}\;z \leq -1.6 \cdot 10^{+15}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-128}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-172}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-69}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;z \leq 0.032:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- 1.0 y))) (t_2 (* z (- x t))) (t_3 (* y (- t x))))
   (if (<= z -1.6e+15)
     t_2
     (if (<= z -6.2e-128)
       t_3
       (if (<= z 1.05e-172)
         t_1
         (if (<= z 2.2e-69) t_3 (if (<= z 0.032) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - y);
	double t_2 = z * (x - t);
	double t_3 = y * (t - x);
	double tmp;
	if (z <= -1.6e+15) {
		tmp = t_2;
	} else if (z <= -6.2e-128) {
		tmp = t_3;
	} else if (z <= 1.05e-172) {
		tmp = t_1;
	} else if (z <= 2.2e-69) {
		tmp = t_3;
	} else if (z <= 0.032) {
		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 * (1.0d0 - y)
    t_2 = z * (x - t)
    t_3 = y * (t - x)
    if (z <= (-1.6d+15)) then
        tmp = t_2
    else if (z <= (-6.2d-128)) then
        tmp = t_3
    else if (z <= 1.05d-172) then
        tmp = t_1
    else if (z <= 2.2d-69) then
        tmp = t_3
    else if (z <= 0.032d0) 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 * (1.0 - y);
	double t_2 = z * (x - t);
	double t_3 = y * (t - x);
	double tmp;
	if (z <= -1.6e+15) {
		tmp = t_2;
	} else if (z <= -6.2e-128) {
		tmp = t_3;
	} else if (z <= 1.05e-172) {
		tmp = t_1;
	} else if (z <= 2.2e-69) {
		tmp = t_3;
	} else if (z <= 0.032) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (1.0 - y)
	t_2 = z * (x - t)
	t_3 = y * (t - x)
	tmp = 0
	if z <= -1.6e+15:
		tmp = t_2
	elif z <= -6.2e-128:
		tmp = t_3
	elif z <= 1.05e-172:
		tmp = t_1
	elif z <= 2.2e-69:
		tmp = t_3
	elif z <= 0.032:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(1.0 - y))
	t_2 = Float64(z * Float64(x - t))
	t_3 = Float64(y * Float64(t - x))
	tmp = 0.0
	if (z <= -1.6e+15)
		tmp = t_2;
	elseif (z <= -6.2e-128)
		tmp = t_3;
	elseif (z <= 1.05e-172)
		tmp = t_1;
	elseif (z <= 2.2e-69)
		tmp = t_3;
	elseif (z <= 0.032)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (1.0 - y);
	t_2 = z * (x - t);
	t_3 = y * (t - x);
	tmp = 0.0;
	if (z <= -1.6e+15)
		tmp = t_2;
	elseif (z <= -6.2e-128)
		tmp = t_3;
	elseif (z <= 1.05e-172)
		tmp = t_1;
	elseif (z <= 2.2e-69)
		tmp = t_3;
	elseif (z <= 0.032)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.6e+15], t$95$2, If[LessEqual[z, -6.2e-128], t$95$3, If[LessEqual[z, 1.05e-172], t$95$1, If[LessEqual[z, 2.2e-69], t$95$3, If[LessEqual[z, 0.032], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -6.2 \cdot 10^{-128}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;z \leq 1.05 \cdot 10^{-172}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-69}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;z \leq 0.032:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.6e15 or 0.032000000000000001 < z

    1. Initial program 100.0%

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

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

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

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

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

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

    if -1.6e15 < z < -6.20000000000000005e-128 or 1.05e-172 < z < 2.2e-69

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

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

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

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

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

    if -6.20000000000000005e-128 < z < 1.05e-172 or 2.2e-69 < z < 0.032000000000000001

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{+15}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-128}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-172}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-69}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 0.032:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 68.2% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;z \leq -1.7 \cdot 10^{-142}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq 1.35 \cdot 10^{-171}:\\
\;\;\;\;x - y \cdot x\\

\mathbf{elif}\;z \leq 5.8 \cdot 10^{-69}:\\
\;\;\;\;t\_2\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.5e16 or 0.070000000000000007 < z

    1. Initial program 100.0%

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

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

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

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

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

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

    if -1.5e16 < z < -1.70000000000000014e-142 or 1.35000000000000007e-171 < z < 5.7999999999999997e-69

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

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

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

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

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

    if -1.70000000000000014e-142 < z < 1.35000000000000007e-171

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - x \cdot y} \]
    8. Simplified74.2%

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

    if 5.7999999999999997e-69 < z < 0.070000000000000007

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{+16}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{-142}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-171}:\\ \;\;\;\;x - y \cdot x\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-69}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 0.07:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 75.8% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;y \leq 4.8 \cdot 10^{-284}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq 4.7 \cdot 10^{-225}:\\
\;\;\;\;x + z \cdot x\\

\mathbf{elif}\;y \leq 54000:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.9999999999999999e52 or 54000 < y

    1. Initial program 100.0%

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

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

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

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

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

    if -7.9999999999999999e52 < y < 4.80000000000000006e-284 or 4.70000000000000014e-225 < y < 54000

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

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

    if 4.80000000000000006e-284 < y < 4.70000000000000014e-225

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8 \cdot 10^{+52}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-284}:\\ \;\;\;\;x - t \cdot \left(z - y\right)\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{-225}:\\ \;\;\;\;x + z \cdot x\\ \mathbf{elif}\;y \leq 54000:\\ \;\;\;\;x - t \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 81.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -84 \lor \neg \left(x \leq 0.0064\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -84 or 0.00640000000000000031 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if -84 < x < 0.00640000000000000031

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

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

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

Alternative 7: 84.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -145000000 \lor \neg \left(z \leq 200000000000\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 -145000000.0) (not (<= z 200000000000.0)))
   (* z (- x t))
   (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -145000000.0) || !(z <= 200000000000.0)) {
		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 <= (-145000000.0d0)) .or. (.not. (z <= 200000000000.0d0))) 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 <= -145000000.0) || !(z <= 200000000000.0)) {
		tmp = z * (x - t);
	} else {
		tmp = x + (y * (t - x));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -145000000.0) or not (z <= 200000000000.0):
		tmp = z * (x - t)
	else:
		tmp = x + (y * (t - x))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -145000000.0) || !(z <= 200000000000.0))
		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 <= -145000000.0) || ~((z <= 200000000000.0)))
		tmp = z * (x - t);
	else
		tmp = x + (y * (t - x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -145000000.0], N[Not[LessEqual[z, 200000000000.0]], $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 -145000000 \lor \neg \left(z \leq 200000000000\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 < -1.45e8 or 2e11 < z

    1. Initial program 100.0%

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

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

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

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

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

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

    if -1.45e8 < z < 2e11

    1. Initial program 100.0%

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

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

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

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

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

Alternative 8: 84.5% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.6499999999999999e-8

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

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

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

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

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

    if -2.6499999999999999e-8 < z < 3.8e13

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

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

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

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

    if 3.8e13 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

Alternative 9: 55.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.4 \cdot 10^{-29} \lor \neg \left(y \leq 52000\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 -4.4e-29) (not (<= y 52000.0))) (* y (- t x)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -4.4e-29) || !(y <= 52000.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 <= (-4.4d-29)) .or. (.not. (y <= 52000.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 <= -4.4e-29) || !(y <= 52000.0)) {
		tmp = y * (t - x);
	} else {
		tmp = x * (1.0 - y);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -4.4e-29) or not (y <= 52000.0):
		tmp = y * (t - x)
	else:
		tmp = x * (1.0 - y)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -4.4e-29) || !(y <= 52000.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 <= -4.4e-29) || ~((y <= 52000.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, -4.4e-29], N[Not[LessEqual[y, 52000.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 -4.4 \cdot 10^{-29} \lor \neg \left(y \leq 52000\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.39999999999999981e-29 or 52000 < y

    1. Initial program 100.0%

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

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

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

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

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

    if -4.39999999999999981e-29 < y < 52000

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

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

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

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

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

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

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

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

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

Alternative 10: 37.2% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.35e20 or 55000 < 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.2%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot y\right)} \]
    10. Step-by-step derivation
      1. associate-*r*45.9%

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

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

        \[\leadsto \color{blue}{y \cdot \left(-x\right)} \]
    11. Simplified45.9%

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

    if -2.35e20 < y < 55000

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

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

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

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

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

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

Alternative 11: 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. Add Preprocessing
  3. Final simplification100.0%

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

Alternative 12: 38.1% 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. Add Preprocessing
  3. Taylor expanded in y around inf 61.2%

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

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

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

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

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

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

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

    \[\leadsto x \cdot \left(1 - y\right) \]
  10. 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 y around inf 61.2%

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

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

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

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

    \[\leadsto x \]
  8. 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 2024077 
(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))))