Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

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

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 0.1× speedup?

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

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

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

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

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

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

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

Alternative 2: 60.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ t_2 := \left(y - z\right) \cdot t\\ \mathbf{if}\;y \leq -5.2 \cdot 10^{+17}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -9.2 \cdot 10^{-104}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{-165}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{-303}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-246}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.35 \cdot 10^{-116}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 2.22 \cdot 10^{-66}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{+19}:\\ \;\;\;\;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 (* (- y z) t)))
   (if (<= y -5.2e+17)
     t_1
     (if (<= y -9.2e-104)
       t_2
       (if (<= y -2.4e-165)
         x
         (if (<= y -1.35e-303)
           t_2
           (if (<= y 2.1e-246)
             x
             (if (<= y 2.35e-116)
               t_2
               (if (<= y 2.22e-66) x (if (<= y 5.2e+19) t_2 t_1))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double t_2 = (y - z) * t;
	double tmp;
	if (y <= -5.2e+17) {
		tmp = t_1;
	} else if (y <= -9.2e-104) {
		tmp = t_2;
	} else if (y <= -2.4e-165) {
		tmp = x;
	} else if (y <= -1.35e-303) {
		tmp = t_2;
	} else if (y <= 2.1e-246) {
		tmp = x;
	} else if (y <= 2.35e-116) {
		tmp = t_2;
	} else if (y <= 2.22e-66) {
		tmp = x;
	} else if (y <= 5.2e+19) {
		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 = (y - z) * t
    if (y <= (-5.2d+17)) then
        tmp = t_1
    else if (y <= (-9.2d-104)) then
        tmp = t_2
    else if (y <= (-2.4d-165)) then
        tmp = x
    else if (y <= (-1.35d-303)) then
        tmp = t_2
    else if (y <= 2.1d-246) then
        tmp = x
    else if (y <= 2.35d-116) then
        tmp = t_2
    else if (y <= 2.22d-66) then
        tmp = x
    else if (y <= 5.2d+19) 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 = (y - z) * t;
	double tmp;
	if (y <= -5.2e+17) {
		tmp = t_1;
	} else if (y <= -9.2e-104) {
		tmp = t_2;
	} else if (y <= -2.4e-165) {
		tmp = x;
	} else if (y <= -1.35e-303) {
		tmp = t_2;
	} else if (y <= 2.1e-246) {
		tmp = x;
	} else if (y <= 2.35e-116) {
		tmp = t_2;
	} else if (y <= 2.22e-66) {
		tmp = x;
	} else if (y <= 5.2e+19) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t - x)
	t_2 = (y - z) * t
	tmp = 0
	if y <= -5.2e+17:
		tmp = t_1
	elif y <= -9.2e-104:
		tmp = t_2
	elif y <= -2.4e-165:
		tmp = x
	elif y <= -1.35e-303:
		tmp = t_2
	elif y <= 2.1e-246:
		tmp = x
	elif y <= 2.35e-116:
		tmp = t_2
	elif y <= 2.22e-66:
		tmp = x
	elif y <= 5.2e+19:
		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(Float64(y - z) * t)
	tmp = 0.0
	if (y <= -5.2e+17)
		tmp = t_1;
	elseif (y <= -9.2e-104)
		tmp = t_2;
	elseif (y <= -2.4e-165)
		tmp = x;
	elseif (y <= -1.35e-303)
		tmp = t_2;
	elseif (y <= 2.1e-246)
		tmp = x;
	elseif (y <= 2.35e-116)
		tmp = t_2;
	elseif (y <= 2.22e-66)
		tmp = x;
	elseif (y <= 5.2e+19)
		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 = (y - z) * t;
	tmp = 0.0;
	if (y <= -5.2e+17)
		tmp = t_1;
	elseif (y <= -9.2e-104)
		tmp = t_2;
	elseif (y <= -2.4e-165)
		tmp = x;
	elseif (y <= -1.35e-303)
		tmp = t_2;
	elseif (y <= 2.1e-246)
		tmp = x;
	elseif (y <= 2.35e-116)
		tmp = t_2;
	elseif (y <= 2.22e-66)
		tmp = x;
	elseif (y <= 5.2e+19)
		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[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[y, -5.2e+17], t$95$1, If[LessEqual[y, -9.2e-104], t$95$2, If[LessEqual[y, -2.4e-165], x, If[LessEqual[y, -1.35e-303], t$95$2, If[LessEqual[y, 2.1e-246], x, If[LessEqual[y, 2.35e-116], t$95$2, If[LessEqual[y, 2.22e-66], x, If[LessEqual[y, 5.2e+19], t$95$2, t$95$1]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -9.2 \cdot 10^{-104}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq -2.4 \cdot 10^{-165}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq -1.35 \cdot 10^{-303}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;y \leq 2.35 \cdot 10^{-116}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq 2.22 \cdot 10^{-66}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 5.2 \cdot 10^{+19}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.2e17 or 5.2e19 < y

    1. Initial program 100.0%

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

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

    if -5.2e17 < y < -9.1999999999999998e-104 or -2.4000000000000002e-165 < y < -1.34999999999999993e-303 or 2.09999999999999995e-246 < y < 2.34999999999999997e-116 or 2.21999999999999996e-66 < y < 5.2e19

    1. Initial program 99.9%

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

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

    if -9.1999999999999998e-104 < y < -2.4000000000000002e-165 or -1.34999999999999993e-303 < y < 2.09999999999999995e-246 or 2.34999999999999997e-116 < y < 2.21999999999999996e-66

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{+17}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -9.2 \cdot 10^{-104}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{-165}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{-303}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-246}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.35 \cdot 10^{-116}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 2.22 \cdot 10^{-66}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{+19}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 3: 70.5% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;y \leq -1.7 \cdot 10^{-97}:\\
\;\;\;\;\left(y - z\right) \cdot t\\

\mathbf{elif}\;y \leq -2.5 \cdot 10^{-163}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;y \leq 10^{+18}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -6.3999999999999999e-15 or 1e18 < y

    1. Initial program 100.0%

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

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

    if -6.3999999999999999e-15 < y < -1.3e-73

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.3e-73 < y < -1.6999999999999999e-97

    1. Initial program 100.0%

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

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

    if -1.6999999999999999e-97 < y < -2.49999999999999989e-163 or -1.9000000000000001e-280 < y < 1e18

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if -2.49999999999999989e-163 < y < -1.9000000000000001e-280

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, y - z, \left(1 + \left(-\left(y - z\right)\right)\right) \cdot x\right)} \]
    5. Taylor expanded in z around inf 86.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.4 \cdot 10^{-15}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -1.3 \cdot 10^{-73}:\\ \;\;\;\;x \cdot \left(z - -1\right)\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-97}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{-163}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq -1.9 \cdot 10^{-280}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 10^{+18}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 4: 37.7% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := -y \cdot x\\
\mathbf{if}\;y \leq -5.4 \cdot 10^{+144}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -2.15 \cdot 10^{+57}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;y \leq -1:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 1.58 \cdot 10^{-55}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 2.7 \cdot 10^{+166}:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.4000000000000003e144 or -2.15000000000000016e57 < y < -1 or 2.70000000000000012e166 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -5.4000000000000003e144 < y < -2.15000000000000016e57 or 1.58000000000000007e-55 < y < 2.70000000000000012e166

    1. Initial program 100.0%

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

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

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

    if -1 < y < 1.58000000000000007e-55

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.4 \cdot 10^{+144}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;y \leq -2.15 \cdot 10^{+57}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -1:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;y \leq 1.58 \cdot 10^{-55}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{+166}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;-y \cdot x\\ \end{array} \]

Alternative 5: 67.7% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;y \leq 5.4 \cdot 10^{-65}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -6.4999999999999998e36 or 6.9e16 < y

    1. Initial program 100.0%

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

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

    if -6.4999999999999998e36 < y < 3.19999999999999995e-117

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, y - z, \left(1 + \left(-\left(y - z\right)\right)\right) \cdot x\right)} \]
    5. Taylor expanded in z around inf 62.6%

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

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

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

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

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

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

    if 3.19999999999999995e-117 < y < 5.3999999999999997e-65

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

    if 5.3999999999999997e-65 < y < 6.9e16

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.5 \cdot 10^{+36}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-117}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-65}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.9 \cdot 10^{+16}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 6: 68.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ t_2 := z \cdot \left(x - t\right)\\ \mathbf{if}\;y \leq -7.2 \cdot 10^{+34}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-116}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-20}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+29}:\\ \;\;\;\;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 (* z (- x t))))
   (if (<= y -7.2e+34)
     t_1
     (if (<= y 1.3e-116)
       t_2
       (if (<= y 2.2e-20) (+ x (* y t)) (if (<= y 3e+29) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double t_2 = z * (x - t);
	double tmp;
	if (y <= -7.2e+34) {
		tmp = t_1;
	} else if (y <= 1.3e-116) {
		tmp = t_2;
	} else if (y <= 2.2e-20) {
		tmp = x + (y * t);
	} else if (y <= 3e+29) {
		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 = z * (x - t)
    if (y <= (-7.2d+34)) then
        tmp = t_1
    else if (y <= 1.3d-116) then
        tmp = t_2
    else if (y <= 2.2d-20) then
        tmp = x + (y * t)
    else if (y <= 3d+29) 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 = z * (x - t);
	double tmp;
	if (y <= -7.2e+34) {
		tmp = t_1;
	} else if (y <= 1.3e-116) {
		tmp = t_2;
	} else if (y <= 2.2e-20) {
		tmp = x + (y * t);
	} else if (y <= 3e+29) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t - x)
	t_2 = z * (x - t)
	tmp = 0
	if y <= -7.2e+34:
		tmp = t_1
	elif y <= 1.3e-116:
		tmp = t_2
	elif y <= 2.2e-20:
		tmp = x + (y * t)
	elif y <= 3e+29:
		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(z * Float64(x - t))
	tmp = 0.0
	if (y <= -7.2e+34)
		tmp = t_1;
	elseif (y <= 1.3e-116)
		tmp = t_2;
	elseif (y <= 2.2e-20)
		tmp = Float64(x + Float64(y * t));
	elseif (y <= 3e+29)
		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 = z * (x - t);
	tmp = 0.0;
	if (y <= -7.2e+34)
		tmp = t_1;
	elseif (y <= 1.3e-116)
		tmp = t_2;
	elseif (y <= 2.2e-20)
		tmp = x + (y * t);
	elseif (y <= 3e+29)
		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[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.2e+34], t$95$1, If[LessEqual[y, 1.3e-116], t$95$2, If[LessEqual[y, 2.2e-20], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+29], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.3 \cdot 10^{-116}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;y \leq 3 \cdot 10^{+29}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.2000000000000001e34 or 2.9999999999999999e29 < y

    1. Initial program 100.0%

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

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

    if -7.2000000000000001e34 < y < 1.3e-116 or 2.19999999999999991e-20 < y < 2.9999999999999999e29

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, y - z, \left(1 + -1 \cdot \left(y - z\right)\right) \cdot x\right)} \]
      2. mul-1-neg99.1%

        \[\leadsto \mathsf{fma}\left(t, y - z, \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \cdot x\right) \]
    4. Simplified99.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, y - z, \left(1 + \left(-\left(y - z\right)\right)\right) \cdot x\right)} \]
    5. Taylor expanded in z around inf 63.5%

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

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

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

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

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

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

    if 1.3e-116 < y < 2.19999999999999991e-20

    1. Initial program 99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.2 \cdot 10^{+34}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-116}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-20}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+29}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 7: 54.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y - z\right) \cdot t\\ \mathbf{if}\;t \leq -4.5 \cdot 10^{-69}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.8 \cdot 10^{-258}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;t \leq 6.9 \cdot 10^{-119}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (- y z) t)))
   (if (<= t -4.5e-69)
     t_1
     (if (<= t 1.8e-258) (* z x) (if (<= t 6.9e-119) (* y (- x)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = (y - z) * t;
	double tmp;
	if (t <= -4.5e-69) {
		tmp = t_1;
	} else if (t <= 1.8e-258) {
		tmp = z * x;
	} else if (t <= 6.9e-119) {
		tmp = y * -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 = (y - z) * t
    if (t <= (-4.5d-69)) then
        tmp = t_1
    else if (t <= 1.8d-258) then
        tmp = z * x
    else if (t <= 6.9d-119) then
        tmp = y * -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 = (y - z) * t;
	double tmp;
	if (t <= -4.5e-69) {
		tmp = t_1;
	} else if (t <= 1.8e-258) {
		tmp = z * x;
	} else if (t <= 6.9e-119) {
		tmp = y * -x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (y - z) * t
	tmp = 0
	if t <= -4.5e-69:
		tmp = t_1
	elif t <= 1.8e-258:
		tmp = z * x
	elif t <= 6.9e-119:
		tmp = y * -x
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(y - z) * t)
	tmp = 0.0
	if (t <= -4.5e-69)
		tmp = t_1;
	elseif (t <= 1.8e-258)
		tmp = Float64(z * x);
	elseif (t <= 6.9e-119)
		tmp = Float64(y * Float64(-x));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (y - z) * t;
	tmp = 0.0;
	if (t <= -4.5e-69)
		tmp = t_1;
	elseif (t <= 1.8e-258)
		tmp = z * x;
	elseif (t <= 6.9e-119)
		tmp = y * -x;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -4.5e-69], t$95$1, If[LessEqual[t, 1.8e-258], N[(z * x), $MachinePrecision], If[LessEqual[t, 6.9e-119], N[(y * (-x)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq 1.8 \cdot 10^{-258}:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;t \leq 6.9 \cdot 10^{-119}:\\
\;\;\;\;y \cdot \left(-x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -4.50000000000000009e-69 or 6.89999999999999953e-119 < t

    1. Initial program 100.0%

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

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

    if -4.50000000000000009e-69 < t < 1.79999999999999989e-258

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, y - z, \left(1 + \left(-\left(y - z\right)\right)\right) \cdot x\right)} \]
    5. Taylor expanded in z around inf 48.1%

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

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

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

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

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

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

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

    if 1.79999999999999989e-258 < t < 6.89999999999999953e-119

    1. Initial program 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.5 \cdot 10^{-69}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;t \leq 1.8 \cdot 10^{-258}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;t \leq 6.9 \cdot 10^{-119}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \end{array} \]

Alternative 8: 84.8% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, y - z, \left(1 + -1 \cdot \left(y - z\right)\right) \cdot x\right)} \]
      2. mul-1-neg97.4%

        \[\leadsto \mathsf{fma}\left(t, y - z, \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \cdot x\right) \]
    4. Simplified97.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, y - z, \left(1 + \left(-\left(y - z\right)\right)\right) \cdot x\right)} \]
    5. Taylor expanded in z around inf 82.3%

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

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

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

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

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

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

    if -3e10 < z < 1.3000000000000001e36

    1. Initial program 100.0%

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

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

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

Alternative 9: 84.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+35}:\\
\;\;\;\;y \cdot \left(t - x\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.4000000000000001e35

    1. Initial program 100.0%

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

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

    if -3.4000000000000001e35 < y < 1.75e31

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if 1.75e31 < y

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.4 \cdot 10^{+35}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{+31}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \left(x - t\right)\\ \end{array} \]

Alternative 10: 34.6% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;t \leq 2.1 \cdot 10^{-258}:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;t \leq 4.9 \cdot 10^{-119}:\\
\;\;\;\;y \cdot \left(-x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -1.05e-47

    1. Initial program 100.0%

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

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

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

    if -1.05e-47 < t < 2.0999999999999999e-258

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0999999999999999e-258 < t < 4.9e-119

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if 4.9e-119 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.05 \cdot 10^{-47}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;t \leq 2.1 \cdot 10^{-258}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;t \leq 4.9 \cdot 10^{-119}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \end{array} \]

Alternative 11: 34.7% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;t \leq 4.8 \cdot 10^{-83}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.15e-48 or 4.8000000000000002e-83 < t

    1. Initial program 100.0%

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

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

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

    if -2.15e-48 < t < 1.14999999999999998e-208

    1. Initial program 99.9%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, y - z, \left(1 + \left(-\left(y - z\right)\right)\right) \cdot x\right)} \]
    5. Taylor expanded in z around inf 46.6%

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

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

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

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

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

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

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

    if 1.14999999999999998e-208 < t < 4.8000000000000002e-83

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.15 \cdot 10^{-48}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{-208}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;t \leq 4.8 \cdot 10^{-83}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]

Alternative 12: 71.6% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.6e34 or 1e18 < y

    1. Initial program 100.0%

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

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

    if -3.6e34 < y < 1e18

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 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. Final simplification100.0%

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

Alternative 14: 36.9% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.00000000000000014e-17 or 6.00000000000000024e-61 < y

    1. Initial program 100.0%

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

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

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

    if -2.00000000000000014e-17 < y < 6.00000000000000024e-61

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-17}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-61}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]

Alternative 15: 17.9% accurate, 9.0× speedup?

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  6. Final simplification17.0%

    \[\leadsto x \]

Developer target: 96.0% accurate, 0.6× speedup?

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

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

Reproduce

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

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

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