Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 6.1s
Alternatives: 9
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 9 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: 54.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + x \cdot z\\ \mathbf{if}\;z \leq -0.52:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-101}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{+26}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+166} \lor \neg \left(z \leq 5.7 \cdot 10^{+232}\right):\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* x z))))
   (if (<= z -0.52)
     t_1
     (if (<= z 3.2e-101)
       (+ x (* y t))
       (if (<= z 1.6e+26)
         (* x (- 1.0 y))
         (if (or (<= z 6e+166) (not (<= z 5.7e+232))) (- x (* z t)) t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = x + (x * z);
	double tmp;
	if (z <= -0.52) {
		tmp = t_1;
	} else if (z <= 3.2e-101) {
		tmp = x + (y * t);
	} else if (z <= 1.6e+26) {
		tmp = x * (1.0 - y);
	} else if ((z <= 6e+166) || !(z <= 5.7e+232)) {
		tmp = x - (z * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + (x * z)
    if (z <= (-0.52d0)) then
        tmp = t_1
    else if (z <= 3.2d-101) then
        tmp = x + (y * t)
    else if (z <= 1.6d+26) then
        tmp = x * (1.0d0 - y)
    else if ((z <= 6d+166) .or. (.not. (z <= 5.7d+232))) then
        tmp = x - (z * t)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x + (x * z);
	double tmp;
	if (z <= -0.52) {
		tmp = t_1;
	} else if (z <= 3.2e-101) {
		tmp = x + (y * t);
	} else if (z <= 1.6e+26) {
		tmp = x * (1.0 - y);
	} else if ((z <= 6e+166) || !(z <= 5.7e+232)) {
		tmp = x - (z * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + (x * z)
	tmp = 0
	if z <= -0.52:
		tmp = t_1
	elif z <= 3.2e-101:
		tmp = x + (y * t)
	elif z <= 1.6e+26:
		tmp = x * (1.0 - y)
	elif (z <= 6e+166) or not (z <= 5.7e+232):
		tmp = x - (z * t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(x * z))
	tmp = 0.0
	if (z <= -0.52)
		tmp = t_1;
	elseif (z <= 3.2e-101)
		tmp = Float64(x + Float64(y * t));
	elseif (z <= 1.6e+26)
		tmp = Float64(x * Float64(1.0 - y));
	elseif ((z <= 6e+166) || !(z <= 5.7e+232))
		tmp = Float64(x - Float64(z * t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + (x * z);
	tmp = 0.0;
	if (z <= -0.52)
		tmp = t_1;
	elseif (z <= 3.2e-101)
		tmp = x + (y * t);
	elseif (z <= 1.6e+26)
		tmp = x * (1.0 - y);
	elseif ((z <= 6e+166) || ~((z <= 5.7e+232)))
		tmp = x - (z * t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.52], t$95$1, If[LessEqual[z, 3.2e-101], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e+26], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 6e+166], N[Not[LessEqual[z, 5.7e+232]], $MachinePrecision]], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + x \cdot z\\
\mathbf{if}\;z \leq -0.52:\\
\;\;\;\;t\_1\\

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

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

\mathbf{elif}\;z \leq 6 \cdot 10^{+166} \lor \neg \left(z \leq 5.7 \cdot 10^{+232}\right):\\
\;\;\;\;x - z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -0.52000000000000002 or 5.99999999999999997e166 < z < 5.69999999999999956e232

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if -0.52000000000000002 < z < 3.19999999999999978e-101

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto x + \color{blue}{t \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative74.5%

        \[\leadsto x + \color{blue}{y \cdot t} \]
    8. Simplified74.5%

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

    if 3.19999999999999978e-101 < z < 1.60000000000000014e26

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if 1.60000000000000014e26 < z < 5.99999999999999997e166 or 5.69999999999999956e232 < 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 63.2%

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
      3. *-commutative54.3%

        \[\leadsto x - \color{blue}{z \cdot t} \]
    6. Simplified54.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.52:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-101}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{+26}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+166} \lor \neg \left(z \leq 5.7 \cdot 10^{+232}\right):\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 55.0% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := x + x \cdot z\\
\mathbf{if}\;z \leq -750:\\
\;\;\;\;t\_1\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -750 or 1.2e29 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if -750 < z < 6.6e-102

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto x + \color{blue}{t \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative74.5%

        \[\leadsto x + \color{blue}{y \cdot t} \]
    8. Simplified74.5%

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

    if 6.6e-102 < z < 1.60000000000000014e26

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if 1.60000000000000014e26 < z < 1.2e29

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

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

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

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

      \[\leadsto x + \color{blue}{t \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto x + \color{blue}{y \cdot t} \]
    8. Simplified100.0%

      \[\leadsto x + \color{blue}{y \cdot t} \]
    9. Taylor expanded in x around 0 100.0%

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

        \[\leadsto \color{blue}{y \cdot t} \]
    11. Simplified100.0%

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

Alternative 4: 50.0% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq -6 \cdot 10^{-298}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;z \leq 1.2 \cdot 10^{+32}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.9e20 or 1.19999999999999996e32 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if -1.9e20 < z < -5.9999999999999999e-298 or 6.5000000000000002e-258 < z < 1.19999999999999996e32

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

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

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

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

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

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

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

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

    if -5.9999999999999999e-298 < z < 6.5000000000000002e-258

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

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

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

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

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

        \[\leadsto x + \color{blue}{y \cdot t} \]
    8. Simplified95.9%

      \[\leadsto x + \color{blue}{y \cdot t} \]
    9. Taylor expanded in x around 0 78.2%

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

        \[\leadsto \color{blue}{y \cdot t} \]
    11. Simplified78.2%

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

Alternative 5: 80.8% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

    if -2.25e17 < x < 4.89999999999999988e-57

    1. Initial program 100.0%

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

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

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

Alternative 6: 67.6% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.6000000000000002e88

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

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

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

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

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

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

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

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

    if -3.6000000000000002e88 < x < 4.9999999999999998e-8

    1. Initial program 100.0%

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

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

    if 4.9999999999999998e-8 < x

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 45.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-179} \lor \neg \left(x \leq 2.1 \cdot 10^{-112}\right):\\
\;\;\;\;x \cdot \left(1 - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.50000000000000003e-179 or 2.1000000000000001e-112 < x

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

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

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

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

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

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

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

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

    if -1.50000000000000003e-179 < x < 2.1000000000000001e-112

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

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

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

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

      \[\leadsto x + \color{blue}{t \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative60.7%

        \[\leadsto x + \color{blue}{y \cdot t} \]
    8. Simplified60.7%

      \[\leadsto x + \color{blue}{y \cdot t} \]
    9. Taylor expanded in x around 0 51.9%

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

        \[\leadsto \color{blue}{y \cdot t} \]
    11. Simplified51.9%

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

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

Alternative 8: 37.7% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.0000000000000003e-18 or 6.5e-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 77.6%

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

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

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

      \[\leadsto x + \color{blue}{t \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative39.5%

        \[\leadsto x + \color{blue}{y \cdot t} \]
    8. Simplified39.5%

      \[\leadsto x + \color{blue}{y \cdot t} \]
    9. Taylor expanded in x around 0 38.7%

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

        \[\leadsto \color{blue}{y \cdot t} \]
    11. Simplified38.7%

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

    if -4.0000000000000003e-18 < y < 6.5e-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 72.1%

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

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

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

Alternative 9: 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 61.9%

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

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

Developer target: 96.0% 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 2024087 
(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))))