Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 0.1× speedup?

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

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

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

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

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

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

Alternative 2: 51.3% accurate, 0.4× speedup?

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

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

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

\mathbf{elif}\;z \leq 2400000000000:\\
\;\;\;\;x + y \cdot t\\

\mathbf{elif}\;z \leq 4.9 \cdot 10^{+58}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.9000000000000001e-56 or 2.4e12 < z < 4.90000000000000018e58

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if -1.9000000000000001e-56 < z < -3.59999999999999979e-258

    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.8%

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

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

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

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

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

    if -3.59999999999999979e-258 < z < 2.4e12

    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} \]
    4. Taylor expanded in y around inf 70.7%

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

    if 4.90000000000000018e58 < 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 57.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.9 \cdot 10^{-56}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-258}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 2400000000000:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 4.9 \cdot 10^{+58}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 48.9% accurate, 0.5× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -21 or 8.1999999999999999e101 < 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 57.9%

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

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

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

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

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

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

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

    if -21 < y < 1.39999999999999992e-9

    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.5%

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

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

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

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

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

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

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

    if 1.39999999999999992e-9 < y < 8.1999999999999999e101

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -21:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-9}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{+101}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 36.6% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;z \leq 1.6 \cdot 10^{-32}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 4.3 \cdot 10^{+58}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.9000000000000001e-56 or 1.6000000000000001e-32 < z < 4.29999999999999991e58

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

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

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

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

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

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

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

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

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

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

    if -1.9000000000000001e-56 < z < 1.6000000000000001e-32

    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.1%

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

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

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

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

    if 4.29999999999999991e58 < 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 57.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.9 \cdot 10^{-56}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-32}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{+58}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 82.9% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -29 or 2.54999999999999994e98 < y

    1. Initial program 100.0%

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

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

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

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

    if -29 < y < 2.54999999999999994e98

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

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

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

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

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

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

Alternative 6: 81.4% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -32 or 3.5e8 < 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 83.9%

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

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

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

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

    if -32 < x < 3.5e8

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

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

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

Alternative 7: 69.8% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -25 or 2.54999999999999994e98 < y

    1. Initial program 100.0%

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

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

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

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

    if -25 < y < 2.54999999999999994e98

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

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

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

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

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

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

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

Alternative 8: 65.1% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.69999999999999982e-53 or 2.2999999999999999e-43 < 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 80.2%

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

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

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

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

    if -3.69999999999999982e-53 < x < 2.2999999999999999e-43

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

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

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

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

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

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

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

Alternative 9: 53.2% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+81} \lor \neg \left(y \leq 2.05 \cdot 10^{+101}\right):\\
\;\;\;\;y \cdot \left(-x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.39999999999999974e81 or 2.05e101 < 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 61.7%

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

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

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

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

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

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

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

    if -4.39999999999999974e81 < y < 2.05e101

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

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

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

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

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

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

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

Alternative 10: 48.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{-56}:\\
\;\;\;\;z \cdot \left(-t\right)\\

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if -1.9000000000000001e-56 < z < 3.4000000000000002e67

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

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

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

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

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

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

    if 3.4000000000000002e67 < 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 54.3%

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

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

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

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

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

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

Alternative 11: 36.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.54 \lor \neg \left(z \leq 19000000000000\right):\\
\;\;\;\;z \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.54000000000000004 or 1.9e13 < 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 50.6%

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

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

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

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

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

    if -0.54000000000000004 < z < 1.9e13

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.54 \lor \neg \left(z \leq 19000000000000\right):\\ \;\;\;\;z \cdot x\\ \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.9% accurate, 9.0× speedup?

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

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

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

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

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

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

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

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

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

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

Reproduce

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