Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 6.9s
Alternatives: 16
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 16 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 0.1× speedup?

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

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

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

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

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

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

Alternative 2: 66.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y - z\right) \cdot t\\ t_2 := y \cdot \left(t - x\right)\\ t_3 := x \cdot \left(z + 1\right)\\ \mathbf{if}\;y \leq -1.55 \cdot 10^{-20}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -2.75 \cdot 10^{-198}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;y \leq -9.6 \cdot 10^{-288}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{-139}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;y \leq 6.6 \cdot 10^{-105}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{+14}:\\ \;\;\;\;t\_3\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (- y z) t)) (t_2 (* y (- t x))) (t_3 (* x (+ z 1.0))))
   (if (<= y -1.55e-20)
     t_2
     (if (<= y -2.75e-198)
       t_3
       (if (<= y -9.6e-288)
         t_1
         (if (<= y 1.65e-139)
           t_3
           (if (<= y 6.6e-105) t_1 (if (<= y 1.65e+14) t_3 t_2))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (y - z) * t;
	double t_2 = y * (t - x);
	double t_3 = x * (z + 1.0);
	double tmp;
	if (y <= -1.55e-20) {
		tmp = t_2;
	} else if (y <= -2.75e-198) {
		tmp = t_3;
	} else if (y <= -9.6e-288) {
		tmp = t_1;
	} else if (y <= 1.65e-139) {
		tmp = t_3;
	} else if (y <= 6.6e-105) {
		tmp = t_1;
	} else if (y <= 1.65e+14) {
		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 = (y - z) * t
    t_2 = y * (t - x)
    t_3 = x * (z + 1.0d0)
    if (y <= (-1.55d-20)) then
        tmp = t_2
    else if (y <= (-2.75d-198)) then
        tmp = t_3
    else if (y <= (-9.6d-288)) then
        tmp = t_1
    else if (y <= 1.65d-139) then
        tmp = t_3
    else if (y <= 6.6d-105) then
        tmp = t_1
    else if (y <= 1.65d+14) 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 = (y - z) * t;
	double t_2 = y * (t - x);
	double t_3 = x * (z + 1.0);
	double tmp;
	if (y <= -1.55e-20) {
		tmp = t_2;
	} else if (y <= -2.75e-198) {
		tmp = t_3;
	} else if (y <= -9.6e-288) {
		tmp = t_1;
	} else if (y <= 1.65e-139) {
		tmp = t_3;
	} else if (y <= 6.6e-105) {
		tmp = t_1;
	} else if (y <= 1.65e+14) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (y - z) * t
	t_2 = y * (t - x)
	t_3 = x * (z + 1.0)
	tmp = 0
	if y <= -1.55e-20:
		tmp = t_2
	elif y <= -2.75e-198:
		tmp = t_3
	elif y <= -9.6e-288:
		tmp = t_1
	elif y <= 1.65e-139:
		tmp = t_3
	elif y <= 6.6e-105:
		tmp = t_1
	elif y <= 1.65e+14:
		tmp = t_3
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(y - z) * t)
	t_2 = Float64(y * Float64(t - x))
	t_3 = Float64(x * Float64(z + 1.0))
	tmp = 0.0
	if (y <= -1.55e-20)
		tmp = t_2;
	elseif (y <= -2.75e-198)
		tmp = t_3;
	elseif (y <= -9.6e-288)
		tmp = t_1;
	elseif (y <= 1.65e-139)
		tmp = t_3;
	elseif (y <= 6.6e-105)
		tmp = t_1;
	elseif (y <= 1.65e+14)
		tmp = t_3;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (y - z) * t;
	t_2 = y * (t - x);
	t_3 = x * (z + 1.0);
	tmp = 0.0;
	if (y <= -1.55e-20)
		tmp = t_2;
	elseif (y <= -2.75e-198)
		tmp = t_3;
	elseif (y <= -9.6e-288)
		tmp = t_1;
	elseif (y <= 1.65e-139)
		tmp = t_3;
	elseif (y <= 6.6e-105)
		tmp = t_1;
	elseif (y <= 1.65e+14)
		tmp = t_3;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.55e-20], t$95$2, If[LessEqual[y, -2.75e-198], t$95$3, If[LessEqual[y, -9.6e-288], t$95$1, If[LessEqual[y, 1.65e-139], t$95$3, If[LessEqual[y, 6.6e-105], t$95$1, If[LessEqual[y, 1.65e+14], t$95$3, t$95$2]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -2.75 \cdot 10^{-198}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;y \leq -9.6 \cdot 10^{-288}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 1.65 \cdot 10^{-139}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;y \leq 6.6 \cdot 10^{-105}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 1.65 \cdot 10^{+14}:\\
\;\;\;\;t\_3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.55e-20 or 1.65e14 < 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.9%

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

    if -1.55e-20 < y < -2.75e-198 or -9.5999999999999994e-288 < y < 1.65e-139 or 6.5999999999999997e-105 < y < 1.65e14

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -2.75e-198 < y < -9.5999999999999994e-288 or 1.65e-139 < y < 6.5999999999999997e-105

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.55 \cdot 10^{-20}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -2.75 \cdot 10^{-198}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq -9.6 \cdot 10^{-288}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{-139}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 6.6 \cdot 10^{-105}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{+14}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 37.7% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;y \leq -1.4 \cdot 10^{-110}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;y \leq -6 \cdot 10^{-196}:\\
\;\;\;\;x\\

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

\mathbf{elif}\;y \leq 9.5 \cdot 10^{-131}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 1.18 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -7.50000000000000038e290 < y < -1.4e-110 or 1.17999999999999996e-29 < y

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{y \cdot t} \]
    6. Simplified52.3%

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

    if -1.4e-110 < y < -6e-196 or 1.45e-213 < y < 9.4999999999999996e-131

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

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

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

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

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

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

    if -6e-196 < y < 1.45e-213 or 9.4999999999999996e-131 < y < 1.17999999999999996e-29

    1. Initial program 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{+290}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{-110}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -6 \cdot 10^{-196}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-213}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-131}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.18 \cdot 10^{-29}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 68.9% 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}\;y \leq -1.95 \cdot 10^{-20}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -1.65 \cdot 10^{-197}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{-213}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-149}:\\ \;\;\;\;x + z \cdot x\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{+14}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- x t))) (t_2 (* y (- t x))))
   (if (<= y -1.95e-20)
     t_2
     (if (<= y -1.65e-197)
       (* x (+ z 1.0))
       (if (<= y 1.25e-213)
         t_1
         (if (<= y 3.2e-149) (+ x (* z x)) (if (<= y 3.9e+14) t_1 t_2)))))))
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 (y <= -1.95e-20) {
		tmp = t_2;
	} else if (y <= -1.65e-197) {
		tmp = x * (z + 1.0);
	} else if (y <= 1.25e-213) {
		tmp = t_1;
	} else if (y <= 3.2e-149) {
		tmp = x + (z * x);
	} else if (y <= 3.9e+14) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = z * (x - t)
    t_2 = y * (t - x)
    if (y <= (-1.95d-20)) then
        tmp = t_2
    else if (y <= (-1.65d-197)) then
        tmp = x * (z + 1.0d0)
    else if (y <= 1.25d-213) then
        tmp = t_1
    else if (y <= 3.2d-149) then
        tmp = x + (z * x)
    else if (y <= 3.9d+14) 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 = z * (x - t);
	double t_2 = y * (t - x);
	double tmp;
	if (y <= -1.95e-20) {
		tmp = t_2;
	} else if (y <= -1.65e-197) {
		tmp = x * (z + 1.0);
	} else if (y <= 1.25e-213) {
		tmp = t_1;
	} else if (y <= 3.2e-149) {
		tmp = x + (z * x);
	} else if (y <= 3.9e+14) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x - t)
	t_2 = y * (t - x)
	tmp = 0
	if y <= -1.95e-20:
		tmp = t_2
	elif y <= -1.65e-197:
		tmp = x * (z + 1.0)
	elif y <= 1.25e-213:
		tmp = t_1
	elif y <= 3.2e-149:
		tmp = x + (z * x)
	elif y <= 3.9e+14:
		tmp = t_1
	else:
		tmp = t_2
	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 (y <= -1.95e-20)
		tmp = t_2;
	elseif (y <= -1.65e-197)
		tmp = Float64(x * Float64(z + 1.0));
	elseif (y <= 1.25e-213)
		tmp = t_1;
	elseif (y <= 3.2e-149)
		tmp = Float64(x + Float64(z * x));
	elseif (y <= 3.9e+14)
		tmp = t_1;
	else
		tmp = t_2;
	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 (y <= -1.95e-20)
		tmp = t_2;
	elseif (y <= -1.65e-197)
		tmp = x * (z + 1.0);
	elseif (y <= 1.25e-213)
		tmp = t_1;
	elseif (y <= 3.2e-149)
		tmp = x + (z * x);
	elseif (y <= 3.9e+14)
		tmp = t_1;
	else
		tmp = t_2;
	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[y, -1.95e-20], t$95$2, If[LessEqual[y, -1.65e-197], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e-213], t$95$1, If[LessEqual[y, 3.2e-149], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.9e+14], t$95$1, t$95$2]]]]]]]
\begin{array}{l}

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

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

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

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

\mathbf{elif}\;y \leq 3.9 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.95000000000000004e-20 or 3.9e14 < 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.9%

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

    if -1.95000000000000004e-20 < y < -1.6499999999999999e-197

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -1.6499999999999999e-197 < y < 1.24999999999999994e-213 or 3.20000000000000002e-149 < y < 3.9e14

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 1.24999999999999994e-213 < y < 3.20000000000000002e-149

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot x + 1 \cdot x} \]
      2. *-un-lft-identity68.4%

        \[\leadsto z \cdot x + \color{blue}{x} \]
    10. Applied egg-rr68.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.95 \cdot 10^{-20}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -1.65 \cdot 10^{-197}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{-213}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-149}:\\ \;\;\;\;x + z \cdot x\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{+14}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 69.0% 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)\\ t_3 := x \cdot \left(z + 1\right)\\ \mathbf{if}\;y \leq -1.5 \cdot 10^{-20}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -4 \cdot 10^{-199}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-213}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 7.1 \cdot 10^{-152}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{+15}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- x t))) (t_2 (* y (- t x))) (t_3 (* x (+ z 1.0))))
   (if (<= y -1.5e-20)
     t_2
     (if (<= y -4e-199)
       t_3
       (if (<= y 1.4e-213)
         t_1
         (if (<= y 7.1e-152) t_3 (if (<= y 4.1e+15) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (x - t);
	double t_2 = y * (t - x);
	double t_3 = x * (z + 1.0);
	double tmp;
	if (y <= -1.5e-20) {
		tmp = t_2;
	} else if (y <= -4e-199) {
		tmp = t_3;
	} else if (y <= 1.4e-213) {
		tmp = t_1;
	} else if (y <= 7.1e-152) {
		tmp = t_3;
	} else if (y <= 4.1e+15) {
		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 = z * (x - t)
    t_2 = y * (t - x)
    t_3 = x * (z + 1.0d0)
    if (y <= (-1.5d-20)) then
        tmp = t_2
    else if (y <= (-4d-199)) then
        tmp = t_3
    else if (y <= 1.4d-213) then
        tmp = t_1
    else if (y <= 7.1d-152) then
        tmp = t_3
    else if (y <= 4.1d+15) 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 = z * (x - t);
	double t_2 = y * (t - x);
	double t_3 = x * (z + 1.0);
	double tmp;
	if (y <= -1.5e-20) {
		tmp = t_2;
	} else if (y <= -4e-199) {
		tmp = t_3;
	} else if (y <= 1.4e-213) {
		tmp = t_1;
	} else if (y <= 7.1e-152) {
		tmp = t_3;
	} else if (y <= 4.1e+15) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x - t)
	t_2 = y * (t - x)
	t_3 = x * (z + 1.0)
	tmp = 0
	if y <= -1.5e-20:
		tmp = t_2
	elif y <= -4e-199:
		tmp = t_3
	elif y <= 1.4e-213:
		tmp = t_1
	elif y <= 7.1e-152:
		tmp = t_3
	elif y <= 4.1e+15:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(x - t))
	t_2 = Float64(y * Float64(t - x))
	t_3 = Float64(x * Float64(z + 1.0))
	tmp = 0.0
	if (y <= -1.5e-20)
		tmp = t_2;
	elseif (y <= -4e-199)
		tmp = t_3;
	elseif (y <= 1.4e-213)
		tmp = t_1;
	elseif (y <= 7.1e-152)
		tmp = t_3;
	elseif (y <= 4.1e+15)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * (x - t);
	t_2 = y * (t - x);
	t_3 = x * (z + 1.0);
	tmp = 0.0;
	if (y <= -1.5e-20)
		tmp = t_2;
	elseif (y <= -4e-199)
		tmp = t_3;
	elseif (y <= 1.4e-213)
		tmp = t_1;
	elseif (y <= 7.1e-152)
		tmp = t_3;
	elseif (y <= 4.1e+15)
		tmp = t_1;
	else
		tmp = t_2;
	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]}, Block[{t$95$3 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.5e-20], t$95$2, If[LessEqual[y, -4e-199], t$95$3, If[LessEqual[y, 1.4e-213], t$95$1, If[LessEqual[y, 7.1e-152], t$95$3, If[LessEqual[y, 4.1e+15], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -4 \cdot 10^{-199}:\\
\;\;\;\;t\_3\\

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

\mathbf{elif}\;y \leq 7.1 \cdot 10^{-152}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;y \leq 4.1 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.50000000000000014e-20 or 4.1e15 < 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.9%

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

    if -1.50000000000000014e-20 < y < -3.99999999999999993e-199 or 1.4e-213 < y < 7.10000000000000011e-152

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -3.99999999999999993e-199 < y < 1.4e-213 or 7.10000000000000011e-152 < y < 4.1e15

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 37.6% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;y \leq -3.6 \cdot 10^{-112}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;y \leq -6.8 \cdot 10^{-194}:\\
\;\;\;\;x\\

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

\mathbf{elif}\;y \leq 1.2 \cdot 10^{-131}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 4.4 \cdot 10^{-31}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.6000000000000001e-112 or 4.40000000000000019e-31 < y

    1. Initial program 100.0%

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

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

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

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

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

    if -3.6000000000000001e-112 < y < -6.80000000000000018e-194 or 1.8e-213 < y < 1.2e-131

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

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

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

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

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

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

    if -6.80000000000000018e-194 < y < 1.8e-213 or 1.2e-131 < y < 4.40000000000000019e-31

    1. Initial program 100.0%

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

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

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

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

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

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

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

Alternative 7: 73.3% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -850000 \lor \neg \left(t \leq -1.45 \cdot 10^{-32} \lor \neg \left(t \leq -4.8 \cdot 10^{-139}\right) \land t \leq 6.4 \cdot 10^{+35}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -8.5e5 or -1.44999999999999998e-32 < t < -4.80000000000000029e-139 or 6.39999999999999965e35 < t

    1. Initial program 100.0%

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

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

    if -8.5e5 < t < -1.44999999999999998e-32 or -4.80000000000000029e-139 < t < 6.39999999999999965e35

    1. Initial program 100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -850000 \lor \neg \left(t \leq -1.45 \cdot 10^{-32} \lor \neg \left(t \leq -4.8 \cdot 10^{-139}\right) \land t \leq 6.4 \cdot 10^{+35}\right):\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 62.0% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -3700:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;t \leq -8.4 \cdot 10^{-148} \lor \neg \left(t \leq 2.25 \cdot 10^{-76}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3700 or -2.0000000000000001e-33 < t < -8.4000000000000001e-148 or 2.25e-76 < t

    1. Initial program 100.0%

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

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

    if -3700 < t < -2.0000000000000001e-33

    1. Initial program 100.0%

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

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

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

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

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

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

    if -8.4000000000000001e-148 < t < 2.25e-76

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3700:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;t \leq -2 \cdot 10^{-33}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;t \leq -8.4 \cdot 10^{-148} \lor \neg \left(t \leq 2.25 \cdot 10^{-76}\right):\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 36.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{-119}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{-306}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-213}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{-29}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -4.2e-119)
   (* y t)
   (if (<= y -2.1e-306)
     x
     (if (<= y 1.9e-213) (* z x) (if (<= y 4.7e-29) x (* y t))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -4.2e-119) {
		tmp = y * t;
	} else if (y <= -2.1e-306) {
		tmp = x;
	} else if (y <= 1.9e-213) {
		tmp = z * x;
	} else if (y <= 4.7e-29) {
		tmp = x;
	} else {
		tmp = y * t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= (-4.2d-119)) then
        tmp = y * t
    else if (y <= (-2.1d-306)) then
        tmp = x
    else if (y <= 1.9d-213) then
        tmp = z * x
    else if (y <= 4.7d-29) then
        tmp = x
    else
        tmp = y * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -4.2e-119) {
		tmp = y * t;
	} else if (y <= -2.1e-306) {
		tmp = x;
	} else if (y <= 1.9e-213) {
		tmp = z * x;
	} else if (y <= 4.7e-29) {
		tmp = x;
	} else {
		tmp = y * t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -4.2e-119:
		tmp = y * t
	elif y <= -2.1e-306:
		tmp = x
	elif y <= 1.9e-213:
		tmp = z * x
	elif y <= 4.7e-29:
		tmp = x
	else:
		tmp = y * t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -4.2e-119)
		tmp = Float64(y * t);
	elseif (y <= -2.1e-306)
		tmp = x;
	elseif (y <= 1.9e-213)
		tmp = Float64(z * x);
	elseif (y <= 4.7e-29)
		tmp = x;
	else
		tmp = Float64(y * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -4.2e-119)
		tmp = y * t;
	elseif (y <= -2.1e-306)
		tmp = x;
	elseif (y <= 1.9e-213)
		tmp = z * x;
	elseif (y <= 4.7e-29)
		tmp = x;
	else
		tmp = y * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.2e-119], N[(y * t), $MachinePrecision], If[LessEqual[y, -2.1e-306], x, If[LessEqual[y, 1.9e-213], N[(z * x), $MachinePrecision], If[LessEqual[y, 4.7e-29], x, N[(y * t), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -2.1 \cdot 10^{-306}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 1.9 \cdot 10^{-213}:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;y \leq 4.7 \cdot 10^{-29}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.2e-119 or 4.6999999999999998e-29 < y

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{y \cdot t} \]
    6. Simplified51.0%

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

    if -4.2e-119 < y < -2.1000000000000001e-306 or 1.9e-213 < y < 4.6999999999999998e-29

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

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

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

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

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

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

    if -2.1000000000000001e-306 < y < 1.9e-213

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{-119}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{-306}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-213}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{-29}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 70.6% accurate, 0.4× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.8000000000000003e-42 or 1.65e14 < 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 81.8%

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

    if -7.8000000000000003e-42 < y < 5.80000000000000007e-105

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

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

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

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

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

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

        \[\leadsto x - \color{blue}{z \cdot t} \]
    8. Simplified74.1%

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

    if 5.80000000000000007e-105 < y < 1.65e14

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 11: 54.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -5 \cdot 10^{-67} \lor \neg \left(y - z \leq 4 \cdot 10^{-62}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 y z) < -4.9999999999999999e-67 or 4.0000000000000002e-62 < (-.f64 y z)

    1. Initial program 100.0%

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

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

    if -4.9999999999999999e-67 < (-.f64 y z) < 4.0000000000000002e-62

    1. Initial program 100.0%

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

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

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

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

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

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

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

Alternative 12: 83.8% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.95000000000000004e-20 or 1.92e15 < 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.9%

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

    if -1.95000000000000004e-20 < y < 1.92e15

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

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

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

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

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

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

Alternative 13: 62.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.4 \cdot 10^{-148} \lor \neg \left(t \leq 9.5 \cdot 10^{-78}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -8.4000000000000001e-148 or 9.4999999999999997e-78 < t

    1. Initial program 100.0%

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

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

    if -8.4000000000000001e-148 < t < 9.4999999999999997e-78

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

Alternative 14: 37.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1.26 \cdot 10^{-14}\right):\\
\;\;\;\;z \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1 or 1.25999999999999996e-14 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 1.25999999999999996e-14

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

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

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

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

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

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

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

Alternative 15: 100.0% accurate, 1.0× speedup?

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

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

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

Alternative 16: 17.9% accurate, 9.0× speedup?

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

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

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

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

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

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

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

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

Developer target: 96.3% 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 2024086 
(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))))