Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 8.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, 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 2: 62.8% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;x \leq -8.4 \cdot 10^{-59}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 8 \cdot 10^{-99}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 2.1 \cdot 10^{+39}:\\
\;\;\;\;x + y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -3.5e8 or 2.0999999999999999e39 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if -3.5e8 < x < -8.39999999999999986e-59 or -5.59999999999999985e-298 < x < 8.0000000000000002e-99

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

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

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

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

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

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

    if -8.39999999999999986e-59 < x < -5.59999999999999985e-298

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

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

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

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

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

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

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

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

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

    if 8.0000000000000002e-99 < x < 2.0999999999999999e39

    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 y around inf 73.6%

      \[\leadsto x + \color{blue}{y} \cdot t \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 3: 38.3% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;z \leq -270:\\
\;\;\;\;z \cdot \left(-t\right)\\

\mathbf{elif}\;z \leq -9.5 \cdot 10^{-160}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq -1.3 \cdot 10^{-275}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.25000000000000007e235 or 6.49999999999999953e-11 < 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 0 64.9%

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

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

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

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

        \[\leadsto x + x \cdot \left(-\color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      5. distribute-neg-in64.9%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(-\left(-z\right)\right) + \left(-y\right)\right)} \]
      6. remove-double-neg64.9%

        \[\leadsto x + x \cdot \left(\color{blue}{z} + \left(-y\right)\right) \]
      7. sub-neg64.9%

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

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

      \[\leadsto \color{blue}{x + x \cdot z} \]
    7. Taylor expanded in z around inf 53.2%

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

    if -1.25000000000000007e235 < z < -270

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

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

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

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

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

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

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

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

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

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

    if -270 < z < -9.5000000000000002e-160 or -1.29999999999999996e-275 < z < 6.49999999999999953e-11

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot t} \]
    9. Simplified53.3%

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

    if -9.5000000000000002e-160 < z < -1.29999999999999996e-275

    1. Initial program 100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{+235}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -270:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-160}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-275}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-11}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 53.4% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq -2.3 \cdot 10^{-162}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 2.1 \cdot 10^{+72}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.8999999999999998e102 or 2.1000000000000001e72 < 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 0 63.9%

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

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

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

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

        \[\leadsto x + x \cdot \left(-\color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      5. distribute-neg-in63.9%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(-\left(-z\right)\right) + \left(-y\right)\right)} \]
      6. remove-double-neg63.9%

        \[\leadsto x + x \cdot \left(\color{blue}{z} + \left(-y\right)\right) \]
      7. sub-neg63.9%

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

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

      \[\leadsto \color{blue}{x + x \cdot z} \]
    7. Taylor expanded in z around inf 59.8%

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

    if -3.8999999999999998e102 < z < -2.2999999999999998e-162 or -6.1999999999999996e-268 < z < 2.1000000000000001e72

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

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

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

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

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

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

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

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

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

    if -2.2999999999999998e-162 < z < -6.1999999999999996e-268

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto x + x \cdot \left(-\color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      5. distribute-neg-in81.8%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(-\left(-z\right)\right) + \left(-y\right)\right)} \]
      6. remove-double-neg81.8%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 39.0% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq -7 \cdot 10^{-160}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq -7 \cdot 10^{-271}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.9999999999999998e40 or 6.49999999999999953e-11 < 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 0 60.9%

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

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

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

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

        \[\leadsto x + x \cdot \left(-\color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      5. distribute-neg-in60.9%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(-\left(-z\right)\right) + \left(-y\right)\right)} \]
      6. remove-double-neg60.9%

        \[\leadsto x + x \cdot \left(\color{blue}{z} + \left(-y\right)\right) \]
      7. sub-neg60.9%

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

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

      \[\leadsto \color{blue}{x + x \cdot z} \]
    7. Taylor expanded in z around inf 48.2%

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

    if -6.9999999999999998e40 < z < -7.0000000000000006e-160 or -6.9999999999999999e-271 < z < 6.49999999999999953e-11

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot t} \]
    9. Simplified50.8%

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

    if -7.0000000000000006e-160 < z < -6.9999999999999999e-271

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 71.5% accurate, 0.4× speedup?

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

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

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

\mathbf{elif}\;y \leq 2.8 \cdot 10^{+16}:\\
\;\;\;\;x + x \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -0.0018500000000000001 or 2.8e16 < 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 77.1%

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

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

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

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

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

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

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

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

    if -0.0018500000000000001 < y < 1.2000000000000001e-96

    1. Initial program 100.0%

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

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

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

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

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

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

    if 1.2000000000000001e-96 < y < 2.8e16

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \color{blue}{\left(\left(-\left(-z\right)\right) + \left(-y\right)\right)} \]
      6. remove-double-neg61.1%

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

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

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

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

Alternative 7: 49.2% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq -8.8 \cdot 10^{+18}:\\
\;\;\;\;z \cdot \left(-t\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.3499999999999999e235 or 1.8e71 < 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 0 65.5%

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

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

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

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

        \[\leadsto x + x \cdot \left(-\color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      5. distribute-neg-in65.5%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(-\left(-z\right)\right) + \left(-y\right)\right)} \]
      6. remove-double-neg65.5%

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

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

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

      \[\leadsto \color{blue}{x + x \cdot z} \]
    7. Taylor expanded in z around inf 61.8%

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

    if -2.3499999999999999e235 < z < -8.8e18

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

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

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

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

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

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

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

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

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

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

    if -8.8e18 < z < 1.8e71

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto x + x \cdot \left(-\color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      5. distribute-neg-in53.0%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(-\left(-z\right)\right) + \left(-y\right)\right)} \]
      6. remove-double-neg53.0%

        \[\leadsto x + x \cdot \left(\color{blue}{z} + \left(-y\right)\right) \]
      7. sub-neg53.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.35 \cdot 10^{+235}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -8.8 \cdot 10^{+18}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+71}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 80.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1000000000 \lor \neg \left(x \leq 3.8 \cdot 10^{+40}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1e9 or 3.80000000000000004e40 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if -1e9 < x < 3.80000000000000004e40

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

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

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

Alternative 9: 71.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.7 \cdot 10^{+40} \lor \neg \left(z \leq 2.7 \cdot 10^{-11}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.70000000000000022e40 or 2.70000000000000005e-11 < 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 0 60.9%

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

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

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

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

        \[\leadsto x + x \cdot \left(-\color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      5. distribute-neg-in60.9%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(-\left(-z\right)\right) + \left(-y\right)\right)} \]
      6. remove-double-neg60.9%

        \[\leadsto x + x \cdot \left(\color{blue}{z} + \left(-y\right)\right) \]
      7. sub-neg60.9%

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

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

    if -6.70000000000000022e40 < z < 2.70000000000000005e-11

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

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

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

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

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

Alternative 10: 67.5% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.5e8 or 4.8e15 < 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 77.7%

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

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

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

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

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

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

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

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

    if -2.5e8 < y < 4.8e15

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto x + x \cdot \left(-\color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      5. distribute-neg-in59.2%

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

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

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

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

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

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

Alternative 11: 36.8% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1 or 1.90000000000000007e-7 < 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 0 59.5%

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

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

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

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

        \[\leadsto x + x \cdot \left(-\color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      5. distribute-neg-in59.5%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(-\left(-z\right)\right) + \left(-y\right)\right)} \]
      6. remove-double-neg59.5%

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

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

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

      \[\leadsto \color{blue}{x + x \cdot z} \]
    7. Taylor expanded in z around inf 46.7%

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

    if -1 < z < 1.90000000000000007e-7

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 12: 17.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{+68}:\\
\;\;\;\;x \cdot y\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x + x \cdot \color{blue}{\left(\left(-\left(-z\right)\right) + \left(-y\right)\right)} \]
      6. remove-double-neg65.1%

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

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

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

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

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

        \[\leadsto x \cdot 1 + \color{blue}{\left(-x \cdot y\right)} \]
      3. distribute-rgt-neg-out13.3%

        \[\leadsto x \cdot 1 + \color{blue}{x \cdot \left(-y\right)} \]
      4. distribute-lft-in13.3%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(0 + \left(-y\right)\right)} \]
      3. add-sqr-sqrt5.3%

        \[\leadsto x \cdot \left(0 + \color{blue}{\sqrt{-y} \cdot \sqrt{-y}}\right) \]
      4. sqrt-unprod10.6%

        \[\leadsto x \cdot \left(0 + \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}\right) \]
      5. sqr-neg10.6%

        \[\leadsto x \cdot \left(0 + \sqrt{\color{blue}{y \cdot y}}\right) \]
      6. sqrt-unprod3.1%

        \[\leadsto x \cdot \left(0 + \color{blue}{\sqrt{y} \cdot \sqrt{y}}\right) \]
      7. add-sqr-sqrt15.7%

        \[\leadsto x \cdot \left(0 + \color{blue}{y}\right) \]
    13. Applied egg-rr15.7%

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

        \[\leadsto x \cdot \color{blue}{y} \]
    15. Simplified15.7%

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

    if -2.19999999999999987e68 < z

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 13: 17.2% 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 55.4%

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

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

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

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

Developer Target 1: 96.4% 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 2024118 
(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))))