Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 10.4s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 0.1× speedup?

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

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

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

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

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

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

Alternative 2: 39.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -8 \cdot 10^{+35}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-221}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-80}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 15500:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 8.6 \cdot 10^{+114}:\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -8e+35)
   (* z x)
   (if (<= z 7.2e-221)
     (* y t)
     (if (<= z 1.8e-80)
       x
       (if (<= z 15500.0) (* y t) (if (<= z 8.6e+114) (* z x) (* z (- t))))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -8e+35) {
		tmp = z * x;
	} else if (z <= 7.2e-221) {
		tmp = y * t;
	} else if (z <= 1.8e-80) {
		tmp = x;
	} else if (z <= 15500.0) {
		tmp = y * t;
	} else if (z <= 8.6e+114) {
		tmp = z * x;
	} else {
		tmp = 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 (z <= (-8d+35)) then
        tmp = z * x
    else if (z <= 7.2d-221) then
        tmp = y * t
    else if (z <= 1.8d-80) then
        tmp = x
    else if (z <= 15500.0d0) then
        tmp = y * t
    else if (z <= 8.6d+114) then
        tmp = z * x
    else
        tmp = z * -t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -8e+35) {
		tmp = z * x;
	} else if (z <= 7.2e-221) {
		tmp = y * t;
	} else if (z <= 1.8e-80) {
		tmp = x;
	} else if (z <= 15500.0) {
		tmp = y * t;
	} else if (z <= 8.6e+114) {
		tmp = z * x;
	} else {
		tmp = z * -t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -8e+35:
		tmp = z * x
	elif z <= 7.2e-221:
		tmp = y * t
	elif z <= 1.8e-80:
		tmp = x
	elif z <= 15500.0:
		tmp = y * t
	elif z <= 8.6e+114:
		tmp = z * x
	else:
		tmp = z * -t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -8e+35)
		tmp = Float64(z * x);
	elseif (z <= 7.2e-221)
		tmp = Float64(y * t);
	elseif (z <= 1.8e-80)
		tmp = x;
	elseif (z <= 15500.0)
		tmp = Float64(y * t);
	elseif (z <= 8.6e+114)
		tmp = Float64(z * x);
	else
		tmp = Float64(z * Float64(-t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -8e+35)
		tmp = z * x;
	elseif (z <= 7.2e-221)
		tmp = y * t;
	elseif (z <= 1.8e-80)
		tmp = x;
	elseif (z <= 15500.0)
		tmp = y * t;
	elseif (z <= 8.6e+114)
		tmp = z * x;
	else
		tmp = z * -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -8e+35], N[(z * x), $MachinePrecision], If[LessEqual[z, 7.2e-221], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.8e-80], x, If[LessEqual[z, 15500.0], N[(y * t), $MachinePrecision], If[LessEqual[z, 8.6e+114], N[(z * x), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 7.2 \cdot 10^{-221}:\\
\;\;\;\;y \cdot t\\

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

\mathbf{elif}\;z \leq 15500:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 8.6 \cdot 10^{+114}:\\
\;\;\;\;z \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -7.9999999999999997e35 or 15500 < z < 8.6000000000000001e114

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if -7.9999999999999997e35 < z < 7.20000000000000022e-221 or 1.8e-80 < z < 15500

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

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

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

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

    if 7.20000000000000022e-221 < z < 1.8e-80

    1. Initial program 99.9%

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

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

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

    if 8.6000000000000001e114 < z

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8 \cdot 10^{+35}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-221}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-80}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 15500:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 8.6 \cdot 10^{+114}:\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 39.3% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-221}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 2.15 \cdot 10^{-79}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 14200:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.30000000000000003e35 or 14200 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if -1.30000000000000003e35 < z < 6.5e-221 or 2.14999999999999991e-79 < z < 14200

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

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

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

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

    if 6.5e-221 < z < 2.14999999999999991e-79

    1. Initial program 99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{+35}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-221}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{-79}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 14200:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 37.7% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;y \leq 5.6 \cdot 10^{-8}:\\
\;\;\;\;x\\

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


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

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

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

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

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

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

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

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

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

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

    if -5.9999999999999997e116 < y < -7.5000000000000006e-98

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto \color{blue}{-t \cdot z} \]
      2. distribute-rgt-neg-out42.7%

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

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

    if -7.5000000000000006e-98 < y < 5.5999999999999999e-8

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

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

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

    if 5.5999999999999999e-8 < y

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

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

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

      \[\leadsto \color{blue}{t \cdot y} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification44.6%

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

Alternative 5: 80.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{-60} \lor \neg \left(t \leq 3.5 \cdot 10^{-69}\right):\\
\;\;\;\;x + \left(y - z\right) \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.50000000000000009e-60 or 3.5000000000000001e-69 < t

    1. Initial program 100.0%

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

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

    if -1.50000000000000009e-60 < t < 3.5000000000000001e-69

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 6: 75.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.9 \cdot 10^{-102} \lor \neg \left(x \leq 2.3 \cdot 10^{+38}\right):\\
\;\;\;\;x \cdot \left(1 - \left(y - z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.9000000000000003e-102 or 2.3000000000000001e38 < 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 84.0%

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

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

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

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

    if -5.9000000000000003e-102 < x < 2.3000000000000001e38

    1. Initial program 99.9%

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

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

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

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

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

Alternative 7: 80.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2.35 \cdot 10^{-60}:\\ \;\;\;\;t \cdot \left(\left(y + \frac{x}{t}\right) - z\right)\\ \mathbf{elif}\;t \leq 1.3 \cdot 10^{-72}:\\ \;\;\;\;x \cdot \left(1 - \left(y - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -2.35e-60)
   (* t (- (+ y (/ x t)) z))
   (if (<= t 1.3e-72) (* x (- 1.0 (- y z))) (+ x (* (- y z) t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -2.35e-60) {
		tmp = t * ((y + (x / t)) - z);
	} else if (t <= 1.3e-72) {
		tmp = x * (1.0 - (y - z));
	} else {
		tmp = x + ((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 (t <= (-2.35d-60)) then
        tmp = t * ((y + (x / t)) - z)
    else if (t <= 1.3d-72) then
        tmp = x * (1.0d0 - (y - z))
    else
        tmp = x + ((y - z) * t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -2.35e-60) {
		tmp = t * ((y + (x / t)) - z);
	} else if (t <= 1.3e-72) {
		tmp = x * (1.0 - (y - z));
	} else {
		tmp = x + ((y - z) * t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -2.35e-60:
		tmp = t * ((y + (x / t)) - z)
	elif t <= 1.3e-72:
		tmp = x * (1.0 - (y - z))
	else:
		tmp = x + ((y - z) * t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -2.35e-60)
		tmp = Float64(t * Float64(Float64(y + Float64(x / t)) - z));
	elseif (t <= 1.3e-72)
		tmp = Float64(x * Float64(1.0 - Float64(y - z)));
	else
		tmp = Float64(x + Float64(Float64(y - z) * t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -2.35e-60)
		tmp = t * ((y + (x / t)) - z);
	elseif (t <= 1.3e-72)
		tmp = x * (1.0 - (y - z));
	else
		tmp = x + ((y - z) * t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.35e-60], N[(t * N[(N[(y + N[(x / t), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.3e-72], N[(x * N[(1.0 - N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.35 \cdot 10^{-60}:\\
\;\;\;\;t \cdot \left(\left(y + \frac{x}{t}\right) - z\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.35e-60

    1. Initial program 99.9%

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

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

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

    if -2.35e-60 < t < 1.29999999999999998e-72

    1. Initial program 99.9%

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

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

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

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

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

    if 1.29999999999999998e-72 < t

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

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

Alternative 8: 62.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.32 \cdot 10^{-33} \lor \neg \left(x \leq 6.5 \cdot 10^{+43}\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.32e-33) (not (<= x 6.5e+43))) (* x (+ z 1.0)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.32e-33) || !(x <= 6.5e+43)) {
		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.32d-33)) .or. (.not. (x <= 6.5d+43))) 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.32e-33) || !(x <= 6.5e+43)) {
		tmp = x * (z + 1.0);
	} else {
		tmp = (y - z) * t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -1.32e-33) or not (x <= 6.5e+43):
		tmp = x * (z + 1.0)
	else:
		tmp = (y - z) * t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -1.32e-33) || !(x <= 6.5e+43))
		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.32e-33) || ~((x <= 6.5e+43)))
		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.32e-33], N[Not[LessEqual[x, 6.5e+43]], $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.32 \cdot 10^{-33} \lor \neg \left(x \leq 6.5 \cdot 10^{+43}\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.31999999999999993e-33 or 6.4999999999999998e43 < 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 87.3%

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

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

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

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

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

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

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

    if -1.31999999999999993e-33 < x < 6.4999999999999998e43

    1. Initial program 99.9%

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

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

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

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

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

Alternative 9: 54.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.45 \cdot 10^{-22} \lor \neg \left(t \leq 3.5 \cdot 10^{-92}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.4499999999999999e-22 or 3.5e-92 < t

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

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

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

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

    if -2.4499999999999999e-22 < t < 3.5e-92

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 62.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{-33}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.31999999999999993e-33

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -1.31999999999999993e-33 < x < 5.6000000000000002e55

    1. Initial program 99.9%

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

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

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

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

    if 5.6000000000000002e55 < 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 92.2%

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

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

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

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

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

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

Alternative 11: 37.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{-105} \lor \neg \left(y \leq 5.8 \cdot 10^{-7}\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.75e-105 or 5.7999999999999995e-7 < y

    1. Initial program 99.9%

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

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

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

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

    if -1.75e-105 < y < 5.7999999999999995e-7

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

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

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

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

Alternative 12: 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 13: 17.7% 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 t around inf 65.1%

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

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

Developer Target 1: 96.2% accurate, 0.6× speedup?

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

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

Reproduce

?
herbie shell --seed 2024131 
(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))))