Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 9.3s
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, 0.1× speedup?

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

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

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

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

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

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

Alternative 2: 56.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ t_2 := z \cdot \left(-t\right)\\ \mathbf{if}\;y \leq -8 \cdot 10^{-50}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{-193}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-83}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.05 \cdot 10^{-19}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (- t x))) (t_2 (* z (- t))))
   (if (<= y -8e-50)
     t_1
     (if (<= y 2.5e-193)
       t_2
       (if (<= y 3.5e-83) x (if (<= y 2.05e-19) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double t_2 = z * -t;
	double tmp;
	if (y <= -8e-50) {
		tmp = t_1;
	} else if (y <= 2.5e-193) {
		tmp = t_2;
	} else if (y <= 3.5e-83) {
		tmp = x;
	} else if (y <= 2.05e-19) {
		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 = y * (t - x)
    t_2 = z * -t
    if (y <= (-8d-50)) then
        tmp = t_1
    else if (y <= 2.5d-193) then
        tmp = t_2
    else if (y <= 3.5d-83) then
        tmp = x
    else if (y <= 2.05d-19) 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 = y * (t - x);
	double t_2 = z * -t;
	double tmp;
	if (y <= -8e-50) {
		tmp = t_1;
	} else if (y <= 2.5e-193) {
		tmp = t_2;
	} else if (y <= 3.5e-83) {
		tmp = x;
	} else if (y <= 2.05e-19) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t - x)
	t_2 = z * -t
	tmp = 0
	if y <= -8e-50:
		tmp = t_1
	elif y <= 2.5e-193:
		tmp = t_2
	elif y <= 3.5e-83:
		tmp = x
	elif y <= 2.05e-19:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(t - x))
	t_2 = Float64(z * Float64(-t))
	tmp = 0.0
	if (y <= -8e-50)
		tmp = t_1;
	elseif (y <= 2.5e-193)
		tmp = t_2;
	elseif (y <= 3.5e-83)
		tmp = x;
	elseif (y <= 2.05e-19)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (t - x);
	t_2 = z * -t;
	tmp = 0.0;
	if (y <= -8e-50)
		tmp = t_1;
	elseif (y <= 2.5e-193)
		tmp = t_2;
	elseif (y <= 3.5e-83)
		tmp = x;
	elseif (y <= 2.05e-19)
		tmp = t_2;
	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]}, Block[{t$95$2 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -8e-50], t$95$1, If[LessEqual[y, 2.5e-193], t$95$2, If[LessEqual[y, 3.5e-83], x, If[LessEqual[y, 2.05e-19], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 2.5 \cdot 10^{-193}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq 3.5 \cdot 10^{-83}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 2.05 \cdot 10^{-19}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -8.00000000000000006e-50 or 2.04999999999999993e-19 < y

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

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

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

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

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

    if -8.00000000000000006e-50 < y < 2.5000000000000002e-193 or 3.5000000000000003e-83 < y < 2.04999999999999993e-19

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

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

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

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

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

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

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

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

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

    if 2.5000000000000002e-193 < y < 3.5000000000000003e-83

    1. Initial program 99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8 \cdot 10^{-50}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{-193}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-83}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.05 \cdot 10^{-19}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 71.9% accurate, 0.4× speedup?

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

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

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

\mathbf{elif}\;z \leq 2.7 \cdot 10^{+21}:\\
\;\;\;\;x + y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.2499999999999999e23 or 2.7e21 < 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.6%

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

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

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

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

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

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

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

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

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

    if -2.2499999999999999e23 < z < -6.20000000000000032e-65

    1. Initial program 100.0%

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

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

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

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

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

    if -6.20000000000000032e-65 < z < 2.7e21

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

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

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

Alternative 4: 37.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(-t\right)\\ \mathbf{if}\;z \leq -3.35 \cdot 10^{+19}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-143}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-20}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- t))))
   (if (<= z -3.35e+19)
     t_1
     (if (<= z -1.65e-143) (* y (- x)) (if (<= z 8.5e-20) x t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = z * -t;
	double tmp;
	if (z <= -3.35e+19) {
		tmp = t_1;
	} else if (z <= -1.65e-143) {
		tmp = y * -x;
	} else if (z <= 8.5e-20) {
		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 <= (-3.35d+19)) then
        tmp = t_1
    else if (z <= (-1.65d-143)) then
        tmp = y * -x
    else if (z <= 8.5d-20) 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 <= -3.35e+19) {
		tmp = t_1;
	} else if (z <= -1.65e-143) {
		tmp = y * -x;
	} else if (z <= 8.5e-20) {
		tmp = x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * -t
	tmp = 0
	if z <= -3.35e+19:
		tmp = t_1
	elif z <= -1.65e-143:
		tmp = y * -x
	elif z <= 8.5e-20:
		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 <= -3.35e+19)
		tmp = t_1;
	elseif (z <= -1.65e-143)
		tmp = Float64(y * Float64(-x));
	elseif (z <= 8.5e-20)
		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 <= -3.35e+19)
		tmp = t_1;
	elseif (z <= -1.65e-143)
		tmp = y * -x;
	elseif (z <= 8.5e-20)
		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, -3.35e+19], t$95$1, If[LessEqual[z, -1.65e-143], N[(y * (-x)), $MachinePrecision], If[LessEqual[z, 8.5e-20], x, t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.65 \cdot 10^{-143}:\\
\;\;\;\;y \cdot \left(-x\right)\\

\mathbf{elif}\;z \leq 8.5 \cdot 10^{-20}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.35e19 or 8.5000000000000005e-20 < 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 83.0%

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

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

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

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

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

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

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

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

    if -3.35e19 < z < -1.65e-143

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - x \cdot y} \]
    8. Simplified62.1%

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

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

        \[\leadsto \color{blue}{-x \cdot y} \]
      2. distribute-rgt-neg-out41.8%

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

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

    if -1.65e-143 < z < 8.5000000000000005e-20

    1. Initial program 99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.35 \cdot 10^{+19}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-143}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-20}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 84.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+21} \lor \neg \left(z \leq 7 \cdot 10^{+27}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.1e21 or 7.0000000000000004e27 < 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.6%

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

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

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

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

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

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

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

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

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

    if -4.1e21 < z < 7.0000000000000004e27

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

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

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

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

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

Alternative 6: 83.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+18}:\\
\;\;\;\;z \cdot \left(x - t\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.2e18

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

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

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

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

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

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

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

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

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

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

    if -4.2e18 < z < 1.4000000000000001e25

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

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

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

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

    if 1.4000000000000001e25 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot x} - z \cdot t \]
    11. Simplified91.0%

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

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

Alternative 7: 68.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+20} \lor \neg \left(z \leq 6400000000000\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.2e20 or 6.4e12 < 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.1%

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

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

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

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

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

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

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

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

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

    if -1.2e20 < z < 6.4e12

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

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

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

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

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

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

Alternative 8: 37.7% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-30} \lor \neg \left(z \leq 10^{-16}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.69999999999999987e-30 or 9.9999999999999998e-17 < 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 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 x around 0 41.5%

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

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

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

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

    if -2.69999999999999987e-30 < z < 9.9999999999999998e-17

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

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

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

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

Alternative 9: 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 10: 18.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 t around inf 64.8%

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

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

Developer Target 1: 96.7% 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 2024139 
(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))))