Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 9.1s
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: 67.4% accurate, 0.4× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.45000000000000008e78 or 5e51 < 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 94.8%

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

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

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

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

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

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

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

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

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

    if -1.45000000000000008e78 < z < -2.09999999999999992e-122

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

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

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

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

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

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

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

    if -2.09999999999999992e-122 < z < 3.90000000000000022e-63

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

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

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

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

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

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

    if 3.90000000000000022e-63 < z < 5e51

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{+78}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-122}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-63}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 5 \cdot 10^{+51}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 66.2% 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 -1 \cdot 10^{+99}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-111}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-52}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{+15}:\\ \;\;\;\;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 -1e+99)
     t_1
     (if (<= y -1.7e-111)
       t_2
       (if (<= y 4.8e-52) (* x (+ z 1.0)) (if (<= y 1.85e+15) 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 <= -1e+99) {
		tmp = t_1;
	} else if (y <= -1.7e-111) {
		tmp = t_2;
	} else if (y <= 4.8e-52) {
		tmp = x * (z + 1.0);
	} else if (y <= 1.85e+15) {
		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 <= (-1d+99)) then
        tmp = t_1
    else if (y <= (-1.7d-111)) then
        tmp = t_2
    else if (y <= 4.8d-52) then
        tmp = x * (z + 1.0d0)
    else if (y <= 1.85d+15) 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 <= -1e+99) {
		tmp = t_1;
	} else if (y <= -1.7e-111) {
		tmp = t_2;
	} else if (y <= 4.8e-52) {
		tmp = x * (z + 1.0);
	} else if (y <= 1.85e+15) {
		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 <= -1e+99:
		tmp = t_1
	elif y <= -1.7e-111:
		tmp = t_2
	elif y <= 4.8e-52:
		tmp = x * (z + 1.0)
	elif y <= 1.85e+15:
		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 <= -1e+99)
		tmp = t_1;
	elseif (y <= -1.7e-111)
		tmp = t_2;
	elseif (y <= 4.8e-52)
		tmp = Float64(x * Float64(z + 1.0));
	elseif (y <= 1.85e+15)
		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 <= -1e+99)
		tmp = t_1;
	elseif (y <= -1.7e-111)
		tmp = t_2;
	elseif (y <= 4.8e-52)
		tmp = x * (z + 1.0);
	elseif (y <= 1.85e+15)
		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, -1e+99], t$95$1, If[LessEqual[y, -1.7e-111], t$95$2, If[LessEqual[y, 4.8e-52], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85e+15], 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 -1 \cdot 10^{+99}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -1.7 \cdot 10^{-111}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;y \leq 1.85 \cdot 10^{+15}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.9999999999999997e98 or 1.85e15 < 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 94.0%

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

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

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

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

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

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

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

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

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

    if -9.9999999999999997e98 < y < -1.69999999999999998e-111 or 4.8000000000000003e-52 < y < 1.85e15

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

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

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

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

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

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

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

    if -1.69999999999999998e-111 < y < 4.8000000000000003e-52

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{+99}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-111}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-52}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{+15}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 37.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(-t\right)\\ \mathbf{if}\;y \leq -1.5 \cdot 10^{+78}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -2.05 \cdot 10^{-159}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-59}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.85 \cdot 10^{+17}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- t))))
   (if (<= y -1.5e+78)
     (* y t)
     (if (<= y -2.05e-159)
       t_1
       (if (<= y 3.6e-59) x (if (<= y 2.85e+17) t_1 (* y (- x))))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * -t;
	double tmp;
	if (y <= -1.5e+78) {
		tmp = y * t;
	} else if (y <= -2.05e-159) {
		tmp = t_1;
	} else if (y <= 3.6e-59) {
		tmp = x;
	} else if (y <= 2.85e+17) {
		tmp = t_1;
	} else {
		tmp = y * -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) :: t_1
    real(8) :: tmp
    t_1 = z * -t
    if (y <= (-1.5d+78)) then
        tmp = y * t
    else if (y <= (-2.05d-159)) then
        tmp = t_1
    else if (y <= 3.6d-59) then
        tmp = x
    else if (y <= 2.85d+17) then
        tmp = t_1
    else
        tmp = y * -x
    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 <= -1.5e+78) {
		tmp = y * t;
	} else if (y <= -2.05e-159) {
		tmp = t_1;
	} else if (y <= 3.6e-59) {
		tmp = x;
	} else if (y <= 2.85e+17) {
		tmp = t_1;
	} else {
		tmp = y * -x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * -t
	tmp = 0
	if y <= -1.5e+78:
		tmp = y * t
	elif y <= -2.05e-159:
		tmp = t_1
	elif y <= 3.6e-59:
		tmp = x
	elif y <= 2.85e+17:
		tmp = t_1
	else:
		tmp = y * -x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(-t))
	tmp = 0.0
	if (y <= -1.5e+78)
		tmp = Float64(y * t);
	elseif (y <= -2.05e-159)
		tmp = t_1;
	elseif (y <= 3.6e-59)
		tmp = x;
	elseif (y <= 2.85e+17)
		tmp = t_1;
	else
		tmp = Float64(y * Float64(-x));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * -t;
	tmp = 0.0;
	if (y <= -1.5e+78)
		tmp = y * t;
	elseif (y <= -2.05e-159)
		tmp = t_1;
	elseif (y <= 3.6e-59)
		tmp = x;
	elseif (y <= 2.85e+17)
		tmp = t_1;
	else
		tmp = y * -x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -1.5e+78], N[(y * t), $MachinePrecision], If[LessEqual[y, -2.05e-159], t$95$1, If[LessEqual[y, 3.6e-59], x, If[LessEqual[y, 2.85e+17], t$95$1, N[(y * (-x)), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -2.05 \cdot 10^{-159}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 3.6 \cdot 10^{-59}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 2.85 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\

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


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

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

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

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

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

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

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

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

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

    if -1.49999999999999991e78 < y < -2.05000000000000007e-159 or 3.6e-59 < y < 2.85e17

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-t \cdot z} \]
      2. *-commutative41.9%

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

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

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

    if -2.05000000000000007e-159 < y < 3.6e-59

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

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

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

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

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

    if 2.85e17 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{+78}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -2.05 \cdot 10^{-159}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-59}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.85 \cdot 10^{+17}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 38.8% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq 4.6 \cdot 10^{-158}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 5 \cdot 10^{-63}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 7.8 \cdot 10^{+40}:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.8e77 or 7.8000000000000002e40 < 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 inf 56.0%

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot x} \]
    8. Simplified45.6%

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

    if -2.8e77 < z < 4.5999999999999998e-158 or 5.0000000000000002e-63 < z < 7.8000000000000002e40

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

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

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

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

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

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

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

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

    if 4.5999999999999998e-158 < z < 5.0000000000000002e-63

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.8 \cdot 10^{+77}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{-158}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-63}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{+40}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 71.8% accurate, 0.4× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.30000000000000004 or 6.49999999999999996e52 < 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 94.8%

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

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

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

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

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

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

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

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

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

    if -1.30000000000000004 < z < 1.20000000000000008e-59

    1. Initial program 100.0%

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

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

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

    if 1.20000000000000008e-59 < z < 6.49999999999999996e52

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

Alternative 7: 55.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -2 \cdot 10^{-11} \lor \neg \left(y - z \leq 2 \cdot 10^{-51}\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) < -1.99999999999999988e-11 or 2e-51 < (-.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 96.0%

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

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

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

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

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

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

    if -1.99999999999999988e-11 < (-.f64 y z) < 2e-51

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

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

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

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

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

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

Alternative 8: 35.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+64}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;y \leq 9 \cdot 10^{-51}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 6.2 \cdot 10^{+26}:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.15e64 or 8.99999999999999948e-51 < y < 6.1999999999999999e26

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

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

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

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

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

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

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

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

    if -1.15e64 < y < 8.99999999999999948e-51

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

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

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

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

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

    if 6.1999999999999999e26 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.15 \cdot 10^{+64}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-51}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{+26}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 83.8% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -940 or 1.1e47 < 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 94.8%

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

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

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

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

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

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

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

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

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

    if -940 < z < 1.1e47

    1. Initial program 100.0%

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

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

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

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

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

Alternative 10: 76.5% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{-18} \lor \neg \left(x \leq 1.7 \cdot 10^{+22}\right):\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.15e-18 or 1.7e22 < x

    1. Initial program 100.0%

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

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

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

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

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

    if -1.15e-18 < x < 1.7e22

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

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

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

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

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

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

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

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

Alternative 11: 83.8% accurate, 0.5× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

    if -22.5 < z < 1.3800000000000001e48

    1. Initial program 100.0%

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

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

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

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

    if 1.3800000000000001e48 < z

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 12: 62.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.15 \cdot 10^{-18} \lor \neg \left(x \leq 1.2 \cdot 10^{+22}\right):\\
\;\;\;\;x \cdot \left(1 - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.1500000000000002e-18 or 1.2e22 < x

    1. Initial program 100.0%

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

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

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

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

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

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

    if -3.1500000000000002e-18 < x < 1.2e22

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

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

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

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

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

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

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

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

Alternative 13: 62.9% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.98 or 4.2e21 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -1.98 < x < 4.2e21

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

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

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

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

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

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

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

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

Alternative 14: 35.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+64} \lor \neg \left(y \leq 10^{-50}\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.15e64 or 1.00000000000000001e-50 < 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 94.9%

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

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

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

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

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

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

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

    if -1.15e64 < y < 1.00000000000000001e-50

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.15 \cdot 10^{+64} \lor \neg \left(y \leq 10^{-50}\right):\\ \;\;\;\;y \cdot t\\ \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.5% accurate, 9.0× speedup?

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

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

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

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

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

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

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

Developer Target 1: 96.1% 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 2024144 
(FPCore (x y z t)
  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
  :precision binary64

  :alt
  (! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))

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