Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 6.1s
Alternatives: 10
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 10 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. Final simplification100.0%

    \[\leadsto x + \left(y - z\right) \cdot \left(t - x\right) \]
  4. Add Preprocessing

Alternative 2: 53.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(-t\right)\\ t_2 := x + y \cdot t\\ \mathbf{if}\;z \leq -7 \cdot 10^{-10}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-27}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+35}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+79}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+101} \lor \neg \left(z \leq 4.3 \cdot 10^{+291}\right):\\ \;\;\;\;x + x \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- t))) (t_2 (+ x (* y t))))
   (if (<= z -7e-10)
     t_1
     (if (<= z 3.6e-27)
       t_2
       (if (<= z 6e+35)
         t_1
         (if (<= z 4.2e+79)
           t_2
           (if (or (<= z 1.1e+101) (not (<= z 4.3e+291)))
             (+ x (* x z))
             t_1)))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * -t;
	double t_2 = x + (y * t);
	double tmp;
	if (z <= -7e-10) {
		tmp = t_1;
	} else if (z <= 3.6e-27) {
		tmp = t_2;
	} else if (z <= 6e+35) {
		tmp = t_1;
	} else if (z <= 4.2e+79) {
		tmp = t_2;
	} else if ((z <= 1.1e+101) || !(z <= 4.3e+291)) {
		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) :: t_2
    real(8) :: tmp
    t_1 = z * -t
    t_2 = x + (y * t)
    if (z <= (-7d-10)) then
        tmp = t_1
    else if (z <= 3.6d-27) then
        tmp = t_2
    else if (z <= 6d+35) then
        tmp = t_1
    else if (z <= 4.2d+79) then
        tmp = t_2
    else if ((z <= 1.1d+101) .or. (.not. (z <= 4.3d+291))) 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 = z * -t;
	double t_2 = x + (y * t);
	double tmp;
	if (z <= -7e-10) {
		tmp = t_1;
	} else if (z <= 3.6e-27) {
		tmp = t_2;
	} else if (z <= 6e+35) {
		tmp = t_1;
	} else if (z <= 4.2e+79) {
		tmp = t_2;
	} else if ((z <= 1.1e+101) || !(z <= 4.3e+291)) {
		tmp = x + (x * z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * -t
	t_2 = x + (y * t)
	tmp = 0
	if z <= -7e-10:
		tmp = t_1
	elif z <= 3.6e-27:
		tmp = t_2
	elif z <= 6e+35:
		tmp = t_1
	elif z <= 4.2e+79:
		tmp = t_2
	elif (z <= 1.1e+101) or not (z <= 4.3e+291):
		tmp = x + (x * z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(-t))
	t_2 = Float64(x + Float64(y * t))
	tmp = 0.0
	if (z <= -7e-10)
		tmp = t_1;
	elseif (z <= 3.6e-27)
		tmp = t_2;
	elseif (z <= 6e+35)
		tmp = t_1;
	elseif (z <= 4.2e+79)
		tmp = t_2;
	elseif ((z <= 1.1e+101) || !(z <= 4.3e+291))
		tmp = Float64(x + Float64(x * z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * -t;
	t_2 = x + (y * t);
	tmp = 0.0;
	if (z <= -7e-10)
		tmp = t_1;
	elseif (z <= 3.6e-27)
		tmp = t_2;
	elseif (z <= 6e+35)
		tmp = t_1;
	elseif (z <= 4.2e+79)
		tmp = t_2;
	elseif ((z <= 1.1e+101) || ~((z <= 4.3e+291)))
		tmp = x + (x * z);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7e-10], t$95$1, If[LessEqual[z, 3.6e-27], t$95$2, If[LessEqual[z, 6e+35], t$95$1, If[LessEqual[z, 4.2e+79], t$95$2, If[Or[LessEqual[z, 1.1e+101], N[Not[LessEqual[z, 4.3e+291]], $MachinePrecision]], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 3.6 \cdot 10^{-27}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq 6 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 4.2 \cdot 10^{+79}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq 1.1 \cdot 10^{+101} \lor \neg \left(z \leq 4.3 \cdot 10^{+291}\right):\\
\;\;\;\;x + x \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.99999999999999961e-10 or 3.5999999999999999e-27 < z < 5.99999999999999981e35 or 1.1e101 < z < 4.2999999999999999e291

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot t\right) \cdot z} \]
      2. *-commutative54.0%

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

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

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

    if -6.99999999999999961e-10 < z < 3.5999999999999999e-27 or 5.99999999999999981e35 < z < 4.20000000000000016e79

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

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

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

    if 4.20000000000000016e79 < z < 1.1e101 or 4.2999999999999999e291 < 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 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{z \cdot x} \]
    8. Simplified90.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7 \cdot 10^{-10}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-27}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+35}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+79}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+101} \lor \neg \left(z \leq 4.3 \cdot 10^{+291}\right):\\ \;\;\;\;x + x \cdot z\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 36.6% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;y \leq -3.6 \cdot 10^{+242}:\\
\;\;\;\;x \cdot \left(-y\right)\\

\mathbf{elif}\;y \leq -1.8 \cdot 10^{-16} \lor \neg \left(y \leq 1.8 \cdot 10^{-26}\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.8000000000000001e270 or -3.59999999999999995e242 < y < -1.79999999999999991e-16 or 1.8000000000000001e-26 < y

    1. Initial program 100.0%

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

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

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

    if -1.8000000000000001e270 < y < -3.59999999999999995e242

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - x \cdot y} \]
    8. Simplified87.9%

      \[\leadsto \color{blue}{x - x \cdot y} \]
    9. Taylor expanded in y around inf 87.9%

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

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

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

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

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

    if -1.79999999999999991e-16 < y < 1.8000000000000001e-26

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{+270}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{+242}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq -1.8 \cdot 10^{-16} \lor \neg \left(y \leq 1.8 \cdot 10^{-26}\right):\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 38.1% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;z \leq -4.5 \cdot 10^{-275}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 7.5 \cdot 10^{-29}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -8.4999999999999996e-10 or 7.50000000000000006e-29 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -8.4999999999999996e-10 < z < -4.49999999999999978e-275

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

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

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

    if -4.49999999999999978e-275 < z < 7.50000000000000006e-29

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.5 \cdot 10^{-10}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{-275}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-29}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 69.5% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.1999999999999995e172 or 1.10000000000000003e105 < 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 93.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.1999999999999995e172 < x < 1.10000000000000003e105

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

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

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

Alternative 6: 81.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.7 \cdot 10^{+25} \lor \neg \left(x \leq 4.5 \cdot 10^{+95}\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 -4.7e+25) (not (<= x 4.5e+95)))
   (+ x (* x (- z y)))
   (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -4.7e+25) || !(x <= 4.5e+95)) {
		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 <= (-4.7d+25)) .or. (.not. (x <= 4.5d+95))) 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 <= -4.7e+25) || !(x <= 4.5e+95)) {
		tmp = x + (x * (z - y));
	} else {
		tmp = x + ((y - z) * t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -4.7e+25) or not (x <= 4.5e+95):
		tmp = x + (x * (z - y))
	else:
		tmp = x + ((y - z) * t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -4.7e+25) || !(x <= 4.5e+95))
		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 <= -4.7e+25) || ~((x <= 4.5e+95)))
		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, -4.7e+25], N[Not[LessEqual[x, 4.5e+95]], $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 -4.7 \cdot 10^{+25} \lor \neg \left(x \leq 4.5 \cdot 10^{+95}\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 < -4.6999999999999998e25 or 4.50000000000000017e95 < 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 85.6%

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

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

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

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

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

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

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

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

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

    if -4.6999999999999998e25 < x < 4.50000000000000017e95

    1. Initial program 100.0%

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

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

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

Alternative 7: 83.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6.5 \cdot 10^{+16} \lor \neg \left(y \leq 8.5 \cdot 10^{-26}\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 -6.5e+16) (not (<= y 8.5e-26)))
   (+ x (* y (- t x)))
   (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -6.5e+16) || !(y <= 8.5e-26)) {
		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 <= (-6.5d+16)) .or. (.not. (y <= 8.5d-26))) 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 <= -6.5e+16) || !(y <= 8.5e-26)) {
		tmp = x + (y * (t - x));
	} else {
		tmp = x + (z * (x - t));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -6.5e+16) or not (y <= 8.5e-26):
		tmp = x + (y * (t - x))
	else:
		tmp = x + (z * (x - t))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -6.5e+16) || !(y <= 8.5e-26))
		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 <= -6.5e+16) || ~((y <= 8.5e-26)))
		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, -6.5e+16], N[Not[LessEqual[y, 8.5e-26]], $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 -6.5 \cdot 10^{+16} \lor \neg \left(y \leq 8.5 \cdot 10^{-26}\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 < -6.5e16 or 8.50000000000000004e-26 < 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 80.2%

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

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

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

    if -6.5e16 < y < 8.50000000000000004e-26

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 53.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.55 \cdot 10^{-9} \lor \neg \left(z \leq 3.6 \cdot 10^{-27}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.54999999999999994e-9 or 3.5999999999999999e-27 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -3.54999999999999994e-9 < z < 3.5999999999999999e-27

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

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

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

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

Alternative 9: 36.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-16} \lor \neg \left(y \leq 2.3 \cdot 10^{-26}\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2e-16 or 2.30000000000000009e-26 < y

    1. Initial program 100.0%

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

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

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

    if -2e-16 < y < 2.30000000000000009e-26

    1. Initial program 100.0%

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

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

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

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

Alternative 10: 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 t around inf 67.5%

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification18.4%

    \[\leadsto x \]
  6. Add Preprocessing

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

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

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