Optimisation.CirclePacking:place from circle-packing-0.1.0.4, B

Percentage Accurate: 99.9% → 99.9%
Time: 8.2s
Alternatives: 11
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{\left(x + y\right) - z}{t \cdot 2} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
	return ((x + y) - z) / (t * 2.0);
}
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 * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
	return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t):
	return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t)
	return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0))
end
function tmp = code(x, y, z, t)
	tmp = ((x + y) - z) / (t * 2.0);
end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\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 11 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: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(x + y\right) - z}{t \cdot 2} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
	return ((x + y) - z) / (t * 2.0);
}
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 * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
	return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t):
	return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t)
	return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0))
end
function tmp = code(x, y, z, t)
	tmp = ((x + y) - z) / (t * 2.0);
end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(x + y\right) - z}{t \cdot 2} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
	return ((x + y) - z) / (t * 2.0);
}
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 * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
	return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t):
	return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t)
	return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0))
end
function tmp = code(x, y, z, t)
	tmp = ((x + y) - z) / (t * 2.0);
end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Derivation
  1. Initial program 100.0%

    \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
  2. Final simplification100.0%

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

Alternative 2: 46.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \frac{0.5}{t}\\ t_2 := \frac{-0.5}{\frac{t}{z}}\\ \mathbf{if}\;y \leq -6.2 \cdot 10^{-153}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.25 \cdot 10^{-205}:\\ \;\;\;\;z \cdot \frac{-0.5}{t}\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-291}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 8.4 \cdot 10^{-14}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+79}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t \cdot 2}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (/ 0.5 t))) (t_2 (/ -0.5 (/ t z))))
   (if (<= y -6.2e-153)
     t_1
     (if (<= y -1.25e-205)
       (* z (/ -0.5 t))
       (if (<= y 1.05e-291)
         t_1
         (if (<= y 8.4e-14)
           t_2
           (if (<= y 4.8e+14)
             t_1
             (if (<= y 6.5e+79) t_2 (/ y (* t 2.0))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (0.5 / t);
	double t_2 = -0.5 / (t / z);
	double tmp;
	if (y <= -6.2e-153) {
		tmp = t_1;
	} else if (y <= -1.25e-205) {
		tmp = z * (-0.5 / t);
	} else if (y <= 1.05e-291) {
		tmp = t_1;
	} else if (y <= 8.4e-14) {
		tmp = t_2;
	} else if (y <= 4.8e+14) {
		tmp = t_1;
	} else if (y <= 6.5e+79) {
		tmp = t_2;
	} else {
		tmp = y / (t * 2.0);
	}
	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 * (0.5d0 / t)
    t_2 = (-0.5d0) / (t / z)
    if (y <= (-6.2d-153)) then
        tmp = t_1
    else if (y <= (-1.25d-205)) then
        tmp = z * ((-0.5d0) / t)
    else if (y <= 1.05d-291) then
        tmp = t_1
    else if (y <= 8.4d-14) then
        tmp = t_2
    else if (y <= 4.8d+14) then
        tmp = t_1
    else if (y <= 6.5d+79) then
        tmp = t_2
    else
        tmp = y / (t * 2.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (0.5 / t);
	double t_2 = -0.5 / (t / z);
	double tmp;
	if (y <= -6.2e-153) {
		tmp = t_1;
	} else if (y <= -1.25e-205) {
		tmp = z * (-0.5 / t);
	} else if (y <= 1.05e-291) {
		tmp = t_1;
	} else if (y <= 8.4e-14) {
		tmp = t_2;
	} else if (y <= 4.8e+14) {
		tmp = t_1;
	} else if (y <= 6.5e+79) {
		tmp = t_2;
	} else {
		tmp = y / (t * 2.0);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (0.5 / t)
	t_2 = -0.5 / (t / z)
	tmp = 0
	if y <= -6.2e-153:
		tmp = t_1
	elif y <= -1.25e-205:
		tmp = z * (-0.5 / t)
	elif y <= 1.05e-291:
		tmp = t_1
	elif y <= 8.4e-14:
		tmp = t_2
	elif y <= 4.8e+14:
		tmp = t_1
	elif y <= 6.5e+79:
		tmp = t_2
	else:
		tmp = y / (t * 2.0)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(0.5 / t))
	t_2 = Float64(-0.5 / Float64(t / z))
	tmp = 0.0
	if (y <= -6.2e-153)
		tmp = t_1;
	elseif (y <= -1.25e-205)
		tmp = Float64(z * Float64(-0.5 / t));
	elseif (y <= 1.05e-291)
		tmp = t_1;
	elseif (y <= 8.4e-14)
		tmp = t_2;
	elseif (y <= 4.8e+14)
		tmp = t_1;
	elseif (y <= 6.5e+79)
		tmp = t_2;
	else
		tmp = Float64(y / Float64(t * 2.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (0.5 / t);
	t_2 = -0.5 / (t / z);
	tmp = 0.0;
	if (y <= -6.2e-153)
		tmp = t_1;
	elseif (y <= -1.25e-205)
		tmp = z * (-0.5 / t);
	elseif (y <= 1.05e-291)
		tmp = t_1;
	elseif (y <= 8.4e-14)
		tmp = t_2;
	elseif (y <= 4.8e+14)
		tmp = t_1;
	elseif (y <= 6.5e+79)
		tmp = t_2;
	else
		tmp = y / (t * 2.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-0.5 / N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.2e-153], t$95$1, If[LessEqual[y, -1.25e-205], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.05e-291], t$95$1, If[LessEqual[y, 8.4e-14], t$95$2, If[LessEqual[y, 4.8e+14], t$95$1, If[LessEqual[y, 6.5e+79], t$95$2, N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \frac{0.5}{t}\\
t_2 := \frac{-0.5}{\frac{t}{z}}\\
\mathbf{if}\;y \leq -6.2 \cdot 10^{-153}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.25 \cdot 10^{-205}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\

\mathbf{elif}\;y \leq 1.05 \cdot 10^{-291}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 8.4 \cdot 10^{-14}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq 4.8 \cdot 10^{+14}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 6.5 \cdot 10^{+79}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -6.1999999999999999e-153 or -1.25e-205 < y < 1.05e-291 or 8.3999999999999995e-14 < y < 4.8e14

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Taylor expanded in y around 0 97.5%

      \[\leadsto \color{blue}{0.5 \cdot \frac{y}{t} + 0.5 \cdot \frac{x - z}{t}} \]
    3. Taylor expanded in x around inf 38.4%

      \[\leadsto \color{blue}{0.5 \cdot \frac{x}{t}} \]
    4. Step-by-step derivation
      1. associate-*r/38.4%

        \[\leadsto \color{blue}{\frac{0.5 \cdot x}{t}} \]
      2. associate-/l*38.3%

        \[\leadsto \color{blue}{\frac{0.5}{\frac{t}{x}}} \]
    5. Simplified38.3%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{t}{x}}} \]
    6. Step-by-step derivation
      1. associate-/r/38.3%

        \[\leadsto \color{blue}{\frac{0.5}{t} \cdot x} \]
    7. Applied egg-rr38.3%

      \[\leadsto \color{blue}{\frac{0.5}{t} \cdot x} \]

    if -6.1999999999999999e-153 < y < -1.25e-205

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.7%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.7%

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

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

    if 1.05e-291 < y < 8.3999999999999995e-14 or 4.8e14 < y < 6.49999999999999954e79

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.7%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.7%

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

      \[\leadsto \frac{-0.5}{t} \cdot \color{blue}{z} \]
    5. Step-by-step derivation
      1. associate-*l/50.8%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot z}{t}} \]
      2. associate-/l*50.6%

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{t}{z}}} \]
    6. Applied egg-rr50.6%

      \[\leadsto \color{blue}{\frac{-0.5}{\frac{t}{z}}} \]

    if 6.49999999999999954e79 < y

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Taylor expanded in y around inf 65.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{-153}:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{elif}\;y \leq -1.25 \cdot 10^{-205}:\\ \;\;\;\;z \cdot \frac{-0.5}{t}\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-291}:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{elif}\;y \leq 8.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{-0.5}{\frac{t}{z}}\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+14}:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+79}:\\ \;\;\;\;\frac{-0.5}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t \cdot 2}\\ \end{array} \]

Alternative 3: 47.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \frac{0.5}{t}\\ t_2 := \frac{z}{\frac{t}{-0.5}}\\ \mathbf{if}\;y \leq -1.42 \cdot 10^{-154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{-205}:\\ \;\;\;\;z \cdot \frac{-0.5}{t}\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-286}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{-11}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+79}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t \cdot 2}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (/ 0.5 t))) (t_2 (/ z (/ t -0.5))))
   (if (<= y -1.42e-154)
     t_1
     (if (<= y -1.1e-205)
       (* z (/ -0.5 t))
       (if (<= y 2e-286)
         t_1
         (if (<= y 2.15e-11)
           t_2
           (if (<= y 5e+14) t_1 (if (<= y 7.2e+79) t_2 (/ y (* t 2.0))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (0.5 / t);
	double t_2 = z / (t / -0.5);
	double tmp;
	if (y <= -1.42e-154) {
		tmp = t_1;
	} else if (y <= -1.1e-205) {
		tmp = z * (-0.5 / t);
	} else if (y <= 2e-286) {
		tmp = t_1;
	} else if (y <= 2.15e-11) {
		tmp = t_2;
	} else if (y <= 5e+14) {
		tmp = t_1;
	} else if (y <= 7.2e+79) {
		tmp = t_2;
	} else {
		tmp = y / (t * 2.0);
	}
	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 * (0.5d0 / t)
    t_2 = z / (t / (-0.5d0))
    if (y <= (-1.42d-154)) then
        tmp = t_1
    else if (y <= (-1.1d-205)) then
        tmp = z * ((-0.5d0) / t)
    else if (y <= 2d-286) then
        tmp = t_1
    else if (y <= 2.15d-11) then
        tmp = t_2
    else if (y <= 5d+14) then
        tmp = t_1
    else if (y <= 7.2d+79) then
        tmp = t_2
    else
        tmp = y / (t * 2.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (0.5 / t);
	double t_2 = z / (t / -0.5);
	double tmp;
	if (y <= -1.42e-154) {
		tmp = t_1;
	} else if (y <= -1.1e-205) {
		tmp = z * (-0.5 / t);
	} else if (y <= 2e-286) {
		tmp = t_1;
	} else if (y <= 2.15e-11) {
		tmp = t_2;
	} else if (y <= 5e+14) {
		tmp = t_1;
	} else if (y <= 7.2e+79) {
		tmp = t_2;
	} else {
		tmp = y / (t * 2.0);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (0.5 / t)
	t_2 = z / (t / -0.5)
	tmp = 0
	if y <= -1.42e-154:
		tmp = t_1
	elif y <= -1.1e-205:
		tmp = z * (-0.5 / t)
	elif y <= 2e-286:
		tmp = t_1
	elif y <= 2.15e-11:
		tmp = t_2
	elif y <= 5e+14:
		tmp = t_1
	elif y <= 7.2e+79:
		tmp = t_2
	else:
		tmp = y / (t * 2.0)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(0.5 / t))
	t_2 = Float64(z / Float64(t / -0.5))
	tmp = 0.0
	if (y <= -1.42e-154)
		tmp = t_1;
	elseif (y <= -1.1e-205)
		tmp = Float64(z * Float64(-0.5 / t));
	elseif (y <= 2e-286)
		tmp = t_1;
	elseif (y <= 2.15e-11)
		tmp = t_2;
	elseif (y <= 5e+14)
		tmp = t_1;
	elseif (y <= 7.2e+79)
		tmp = t_2;
	else
		tmp = Float64(y / Float64(t * 2.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (0.5 / t);
	t_2 = z / (t / -0.5);
	tmp = 0.0;
	if (y <= -1.42e-154)
		tmp = t_1;
	elseif (y <= -1.1e-205)
		tmp = z * (-0.5 / t);
	elseif (y <= 2e-286)
		tmp = t_1;
	elseif (y <= 2.15e-11)
		tmp = t_2;
	elseif (y <= 5e+14)
		tmp = t_1;
	elseif (y <= 7.2e+79)
		tmp = t_2;
	else
		tmp = y / (t * 2.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z / N[(t / -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.42e-154], t$95$1, If[LessEqual[y, -1.1e-205], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e-286], t$95$1, If[LessEqual[y, 2.15e-11], t$95$2, If[LessEqual[y, 5e+14], t$95$1, If[LessEqual[y, 7.2e+79], t$95$2, N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \frac{0.5}{t}\\
t_2 := \frac{z}{\frac{t}{-0.5}}\\
\mathbf{if}\;y \leq -1.42 \cdot 10^{-154}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.1 \cdot 10^{-205}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\

\mathbf{elif}\;y \leq 2 \cdot 10^{-286}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 2.15 \cdot 10^{-11}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq 5 \cdot 10^{+14}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 7.2 \cdot 10^{+79}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.42e-154 or -1.10000000000000005e-205 < y < 2.0000000000000001e-286 or 2.15000000000000001e-11 < y < 5e14

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Taylor expanded in y around 0 97.5%

      \[\leadsto \color{blue}{0.5 \cdot \frac{y}{t} + 0.5 \cdot \frac{x - z}{t}} \]
    3. Taylor expanded in x around inf 37.8%

      \[\leadsto \color{blue}{0.5 \cdot \frac{x}{t}} \]
    4. Step-by-step derivation
      1. associate-*r/37.8%

        \[\leadsto \color{blue}{\frac{0.5 \cdot x}{t}} \]
      2. associate-/l*37.7%

        \[\leadsto \color{blue}{\frac{0.5}{\frac{t}{x}}} \]
    5. Simplified37.7%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{t}{x}}} \]
    6. Step-by-step derivation
      1. associate-/r/37.7%

        \[\leadsto \color{blue}{\frac{0.5}{t} \cdot x} \]
    7. Applied egg-rr37.7%

      \[\leadsto \color{blue}{\frac{0.5}{t} \cdot x} \]

    if -1.42e-154 < y < -1.10000000000000005e-205

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.7%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.7%

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

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

    if 2.0000000000000001e-286 < y < 2.15000000000000001e-11 or 5e14 < y < 7.1999999999999999e79

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.7%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.7%

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{z}{t}} \]
    5. Step-by-step derivation
      1. associate-*r/50.5%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot z}{t}} \]
      2. *-commutative50.5%

        \[\leadsto \frac{\color{blue}{z \cdot -0.5}}{t} \]
      3. associate-/l*50.5%

        \[\leadsto \color{blue}{\frac{z}{\frac{t}{-0.5}}} \]
    6. Simplified50.5%

      \[\leadsto \color{blue}{\frac{z}{\frac{t}{-0.5}}} \]

    if 7.1999999999999999e79 < y

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Taylor expanded in y around inf 65.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.42 \cdot 10^{-154}:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{-205}:\\ \;\;\;\;z \cdot \frac{-0.5}{t}\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-286}:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{-11}:\\ \;\;\;\;\frac{z}{\frac{t}{-0.5}}\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+14}:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+79}:\\ \;\;\;\;\frac{z}{\frac{t}{-0.5}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t \cdot 2}\\ \end{array} \]

Alternative 4: 46.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x \cdot 0.5}{t}\\ t_2 := \frac{z}{\frac{t}{-0.5}}\\ \mathbf{if}\;y \leq -7 \cdot 10^{-153}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.08 \cdot 10^{-197}:\\ \;\;\;\;z \cdot \frac{-0.5}{t}\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-291}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{-14}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+14}:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+79}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t \cdot 2}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* x 0.5) t)) (t_2 (/ z (/ t -0.5))))
   (if (<= y -7e-153)
     t_1
     (if (<= y -1.08e-197)
       (* z (/ -0.5 t))
       (if (<= y 4.8e-291)
         t_1
         (if (<= y 3.7e-14)
           t_2
           (if (<= y 4.8e+14)
             (* x (/ 0.5 t))
             (if (<= y 7e+79) t_2 (/ y (* t 2.0))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x * 0.5) / t;
	double t_2 = z / (t / -0.5);
	double tmp;
	if (y <= -7e-153) {
		tmp = t_1;
	} else if (y <= -1.08e-197) {
		tmp = z * (-0.5 / t);
	} else if (y <= 4.8e-291) {
		tmp = t_1;
	} else if (y <= 3.7e-14) {
		tmp = t_2;
	} else if (y <= 4.8e+14) {
		tmp = x * (0.5 / t);
	} else if (y <= 7e+79) {
		tmp = t_2;
	} else {
		tmp = y / (t * 2.0);
	}
	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 * 0.5d0) / t
    t_2 = z / (t / (-0.5d0))
    if (y <= (-7d-153)) then
        tmp = t_1
    else if (y <= (-1.08d-197)) then
        tmp = z * ((-0.5d0) / t)
    else if (y <= 4.8d-291) then
        tmp = t_1
    else if (y <= 3.7d-14) then
        tmp = t_2
    else if (y <= 4.8d+14) then
        tmp = x * (0.5d0 / t)
    else if (y <= 7d+79) then
        tmp = t_2
    else
        tmp = y / (t * 2.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (x * 0.5) / t;
	double t_2 = z / (t / -0.5);
	double tmp;
	if (y <= -7e-153) {
		tmp = t_1;
	} else if (y <= -1.08e-197) {
		tmp = z * (-0.5 / t);
	} else if (y <= 4.8e-291) {
		tmp = t_1;
	} else if (y <= 3.7e-14) {
		tmp = t_2;
	} else if (y <= 4.8e+14) {
		tmp = x * (0.5 / t);
	} else if (y <= 7e+79) {
		tmp = t_2;
	} else {
		tmp = y / (t * 2.0);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x * 0.5) / t
	t_2 = z / (t / -0.5)
	tmp = 0
	if y <= -7e-153:
		tmp = t_1
	elif y <= -1.08e-197:
		tmp = z * (-0.5 / t)
	elif y <= 4.8e-291:
		tmp = t_1
	elif y <= 3.7e-14:
		tmp = t_2
	elif y <= 4.8e+14:
		tmp = x * (0.5 / t)
	elif y <= 7e+79:
		tmp = t_2
	else:
		tmp = y / (t * 2.0)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x * 0.5) / t)
	t_2 = Float64(z / Float64(t / -0.5))
	tmp = 0.0
	if (y <= -7e-153)
		tmp = t_1;
	elseif (y <= -1.08e-197)
		tmp = Float64(z * Float64(-0.5 / t));
	elseif (y <= 4.8e-291)
		tmp = t_1;
	elseif (y <= 3.7e-14)
		tmp = t_2;
	elseif (y <= 4.8e+14)
		tmp = Float64(x * Float64(0.5 / t));
	elseif (y <= 7e+79)
		tmp = t_2;
	else
		tmp = Float64(y / Float64(t * 2.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x * 0.5) / t;
	t_2 = z / (t / -0.5);
	tmp = 0.0;
	if (y <= -7e-153)
		tmp = t_1;
	elseif (y <= -1.08e-197)
		tmp = z * (-0.5 / t);
	elseif (y <= 4.8e-291)
		tmp = t_1;
	elseif (y <= 3.7e-14)
		tmp = t_2;
	elseif (y <= 4.8e+14)
		tmp = x * (0.5 / t);
	elseif (y <= 7e+79)
		tmp = t_2;
	else
		tmp = y / (t * 2.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(z / N[(t / -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7e-153], t$95$1, If[LessEqual[y, -1.08e-197], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e-291], t$95$1, If[LessEqual[y, 3.7e-14], t$95$2, If[LessEqual[y, 4.8e+14], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+79], t$95$2, N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{x \cdot 0.5}{t}\\
t_2 := \frac{z}{\frac{t}{-0.5}}\\
\mathbf{if}\;y \leq -7 \cdot 10^{-153}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.08 \cdot 10^{-197}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\

\mathbf{elif}\;y \leq 4.8 \cdot 10^{-291}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 3.7 \cdot 10^{-14}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq 4.8 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\

\mathbf{elif}\;y \leq 7 \cdot 10^{+79}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -6.99999999999999961e-153 or -1.0800000000000001e-197 < y < 4.80000000000000025e-291

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.7%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.7%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{x}{t}} \]
    5. Step-by-step derivation
      1. *-commutative36.8%

        \[\leadsto \color{blue}{\frac{x}{t} \cdot 0.5} \]
      2. associate-*l/36.8%

        \[\leadsto \color{blue}{\frac{x \cdot 0.5}{t}} \]
    6. Simplified36.8%

      \[\leadsto \color{blue}{\frac{x \cdot 0.5}{t}} \]

    if -6.99999999999999961e-153 < y < -1.0800000000000001e-197

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.7%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.7%

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

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

    if 4.80000000000000025e-291 < y < 3.70000000000000001e-14 or 4.8e14 < y < 6.99999999999999961e79

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.7%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.7%

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{z}{t}} \]
    5. Step-by-step derivation
      1. associate-*r/50.5%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot z}{t}} \]
      2. *-commutative50.5%

        \[\leadsto \frac{\color{blue}{z \cdot -0.5}}{t} \]
      3. associate-/l*50.5%

        \[\leadsto \color{blue}{\frac{z}{\frac{t}{-0.5}}} \]
    6. Simplified50.5%

      \[\leadsto \color{blue}{\frac{z}{\frac{t}{-0.5}}} \]

    if 3.70000000000000001e-14 < y < 4.8e14

    1. Initial program 99.8%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Taylor expanded in y around 0 100.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{y}{t} + 0.5 \cdot \frac{x - z}{t}} \]
    3. Taylor expanded in x around inf 54.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{x}{t}} \]
    4. Step-by-step derivation
      1. associate-*r/54.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot x}{t}} \]
      2. associate-/l*53.8%

        \[\leadsto \color{blue}{\frac{0.5}{\frac{t}{x}}} \]
    5. Simplified53.8%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{t}{x}}} \]
    6. Step-by-step derivation
      1. associate-/r/54.0%

        \[\leadsto \color{blue}{\frac{0.5}{t} \cdot x} \]
    7. Applied egg-rr54.0%

      \[\leadsto \color{blue}{\frac{0.5}{t} \cdot x} \]

    if 6.99999999999999961e79 < y

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Taylor expanded in y around inf 65.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{-153}:\\ \;\;\;\;\frac{x \cdot 0.5}{t}\\ \mathbf{elif}\;y \leq -1.08 \cdot 10^{-197}:\\ \;\;\;\;z \cdot \frac{-0.5}{t}\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-291}:\\ \;\;\;\;\frac{x \cdot 0.5}{t}\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{-14}:\\ \;\;\;\;\frac{z}{\frac{t}{-0.5}}\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+14}:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+79}:\\ \;\;\;\;\frac{z}{\frac{t}{-0.5}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t \cdot 2}\\ \end{array} \]

Alternative 5: 77.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x - z}{t \cdot 2}\\ \mathbf{if}\;x \leq -9.5 \cdot 10^{+86}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{+33}:\\ \;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\ \mathbf{elif}\;x \leq -0.00076 \lor \neg \left(x \leq -2.45 \cdot 10^{-46}\right) \land x \leq -1.95 \cdot 10^{-72}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.5}{t} \cdot \left(z - y\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (- x z) (* t 2.0))))
   (if (<= x -9.5e+86)
     t_1
     (if (<= x -1.15e+33)
       (* (+ x y) (/ 0.5 t))
       (if (or (<= x -0.00076) (and (not (<= x -2.45e-46)) (<= x -1.95e-72)))
         t_1
         (* (/ -0.5 t) (- z y)))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x - z) / (t * 2.0);
	double tmp;
	if (x <= -9.5e+86) {
		tmp = t_1;
	} else if (x <= -1.15e+33) {
		tmp = (x + y) * (0.5 / t);
	} else if ((x <= -0.00076) || (!(x <= -2.45e-46) && (x <= -1.95e-72))) {
		tmp = t_1;
	} else {
		tmp = (-0.5 / t) * (z - y);
	}
	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 - z) / (t * 2.0d0)
    if (x <= (-9.5d+86)) then
        tmp = t_1
    else if (x <= (-1.15d+33)) then
        tmp = (x + y) * (0.5d0 / t)
    else if ((x <= (-0.00076d0)) .or. (.not. (x <= (-2.45d-46))) .and. (x <= (-1.95d-72))) then
        tmp = t_1
    else
        tmp = ((-0.5d0) / t) * (z - y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (x - z) / (t * 2.0);
	double tmp;
	if (x <= -9.5e+86) {
		tmp = t_1;
	} else if (x <= -1.15e+33) {
		tmp = (x + y) * (0.5 / t);
	} else if ((x <= -0.00076) || (!(x <= -2.45e-46) && (x <= -1.95e-72))) {
		tmp = t_1;
	} else {
		tmp = (-0.5 / t) * (z - y);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x - z) / (t * 2.0)
	tmp = 0
	if x <= -9.5e+86:
		tmp = t_1
	elif x <= -1.15e+33:
		tmp = (x + y) * (0.5 / t)
	elif (x <= -0.00076) or (not (x <= -2.45e-46) and (x <= -1.95e-72)):
		tmp = t_1
	else:
		tmp = (-0.5 / t) * (z - y)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x - z) / Float64(t * 2.0))
	tmp = 0.0
	if (x <= -9.5e+86)
		tmp = t_1;
	elseif (x <= -1.15e+33)
		tmp = Float64(Float64(x + y) * Float64(0.5 / t));
	elseif ((x <= -0.00076) || (!(x <= -2.45e-46) && (x <= -1.95e-72)))
		tmp = t_1;
	else
		tmp = Float64(Float64(-0.5 / t) * Float64(z - y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x - z) / (t * 2.0);
	tmp = 0.0;
	if (x <= -9.5e+86)
		tmp = t_1;
	elseif (x <= -1.15e+33)
		tmp = (x + y) * (0.5 / t);
	elseif ((x <= -0.00076) || (~((x <= -2.45e-46)) && (x <= -1.95e-72)))
		tmp = t_1;
	else
		tmp = (-0.5 / t) * (z - y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.5e+86], t$95$1, If[LessEqual[x, -1.15e+33], N[(N[(x + y), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -0.00076], And[N[Not[LessEqual[x, -2.45e-46]], $MachinePrecision], LessEqual[x, -1.95e-72]]], t$95$1, N[(N[(-0.5 / t), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{x - z}{t \cdot 2}\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{+86}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -1.15 \cdot 10^{+33}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\

\mathbf{elif}\;x \leq -0.00076 \lor \neg \left(x \leq -2.45 \cdot 10^{-46}\right) \land x \leq -1.95 \cdot 10^{-72}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -9.50000000000000028e86 or -1.15000000000000005e33 < x < -7.6000000000000004e-4 or -2.45e-46 < x < -1.95e-72

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Taylor expanded in y around 0 92.3%

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

    if -9.50000000000000028e86 < x < -1.15000000000000005e33

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.8%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.8%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.8%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.8%

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

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

        \[\leadsto \color{blue}{\frac{y + x}{t} \cdot 0.5} \]
      2. +-commutative98.5%

        \[\leadsto \frac{\color{blue}{x + y}}{t} \cdot 0.5 \]
      3. associate-*l/98.5%

        \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot 0.5}{t}} \]
      4. associate-*r/98.4%

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

        \[\leadsto \color{blue}{\left(y + x\right)} \cdot \frac{0.5}{t} \]
    6. Simplified98.4%

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

    if -7.6000000000000004e-4 < x < -2.45e-46 or -1.95e-72 < x

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.8%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.8%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.8%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+86}:\\ \;\;\;\;\frac{x - z}{t \cdot 2}\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{+33}:\\ \;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\ \mathbf{elif}\;x \leq -0.00076 \lor \neg \left(x \leq -2.45 \cdot 10^{-46}\right) \land x \leq -1.95 \cdot 10^{-72}:\\ \;\;\;\;\frac{x - z}{t \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.5}{t} \cdot \left(z - y\right)\\ \end{array} \]

Alternative 6: 76.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{+163} \lor \neg \left(x \leq -3 \cdot 10^{+81}\right) \land x \leq -4.2 \cdot 10^{+43}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.79999999999999945e163 or -2.99999999999999997e81 < x < -4.20000000000000003e43

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.7%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.7%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{y + x}{t}} \]
    5. Step-by-step derivation
      1. *-commutative97.0%

        \[\leadsto \color{blue}{\frac{y + x}{t} \cdot 0.5} \]
      2. +-commutative97.0%

        \[\leadsto \frac{\color{blue}{x + y}}{t} \cdot 0.5 \]
      3. associate-*l/97.0%

        \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot 0.5}{t}} \]
      4. associate-*r/96.7%

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

        \[\leadsto \color{blue}{\left(y + x\right)} \cdot \frac{0.5}{t} \]
    6. Simplified96.7%

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

    if -8.79999999999999945e163 < x < -2.99999999999999997e81 or -4.20000000000000003e43 < x

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.7%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.8 \cdot 10^{+163} \lor \neg \left(x \leq -3 \cdot 10^{+81}\right) \land x \leq -4.2 \cdot 10^{+43}:\\ \;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.5}{t} \cdot \left(z - y\right)\\ \end{array} \]

Alternative 7: 44.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+164} \lor \neg \left(x \leq -2.2 \cdot 10^{+81}\right) \land x \leq -3 \cdot 10^{+43}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\

\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1e164 or -2.19999999999999987e81 < x < -3.00000000000000017e43

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Taylor expanded in y around 0 97.4%

      \[\leadsto \color{blue}{0.5 \cdot \frac{y}{t} + 0.5 \cdot \frac{x - z}{t}} \]
    3. Taylor expanded in x around inf 90.1%

      \[\leadsto \color{blue}{0.5 \cdot \frac{x}{t}} \]
    4. Step-by-step derivation
      1. associate-*r/90.1%

        \[\leadsto \color{blue}{\frac{0.5 \cdot x}{t}} \]
      2. associate-/l*89.6%

        \[\leadsto \color{blue}{\frac{0.5}{\frac{t}{x}}} \]
    5. Simplified89.6%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{t}{x}}} \]
    6. Step-by-step derivation
      1. associate-/r/89.8%

        \[\leadsto \color{blue}{\frac{0.5}{t} \cdot x} \]
    7. Applied egg-rr89.8%

      \[\leadsto \color{blue}{\frac{0.5}{t} \cdot x} \]

    if -1e164 < x < -2.19999999999999987e81 or -3.00000000000000017e43 < x

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.7%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.7%

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

      \[\leadsto \frac{-0.5}{t} \cdot \color{blue}{z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification52.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+164} \lor \neg \left(x \leq -2.2 \cdot 10^{+81}\right) \land x \leq -3 \cdot 10^{+43}:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{-0.5}{t}\\ \end{array} \]

Alternative 8: 44.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \frac{0.5}{t}\\ \mathbf{if}\;x \leq -8.8 \cdot 10^{+163}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{+81}:\\ \;\;\;\;\frac{-0.5}{\frac{t}{z}}\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{+43}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{-0.5}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (/ 0.5 t))))
   (if (<= x -8.8e+163)
     t_1
     (if (<= x -1.8e+81)
       (/ -0.5 (/ t z))
       (if (<= x -3.5e+43) t_1 (* z (/ -0.5 t)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (0.5 / t);
	double tmp;
	if (x <= -8.8e+163) {
		tmp = t_1;
	} else if (x <= -1.8e+81) {
		tmp = -0.5 / (t / z);
	} else if (x <= -3.5e+43) {
		tmp = t_1;
	} else {
		tmp = z * (-0.5 / 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) :: t_1
    real(8) :: tmp
    t_1 = x * (0.5d0 / t)
    if (x <= (-8.8d+163)) then
        tmp = t_1
    else if (x <= (-1.8d+81)) then
        tmp = (-0.5d0) / (t / z)
    else if (x <= (-3.5d+43)) then
        tmp = t_1
    else
        tmp = z * ((-0.5d0) / t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (0.5 / t);
	double tmp;
	if (x <= -8.8e+163) {
		tmp = t_1;
	} else if (x <= -1.8e+81) {
		tmp = -0.5 / (t / z);
	} else if (x <= -3.5e+43) {
		tmp = t_1;
	} else {
		tmp = z * (-0.5 / t);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (0.5 / t)
	tmp = 0
	if x <= -8.8e+163:
		tmp = t_1
	elif x <= -1.8e+81:
		tmp = -0.5 / (t / z)
	elif x <= -3.5e+43:
		tmp = t_1
	else:
		tmp = z * (-0.5 / t)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(0.5 / t))
	tmp = 0.0
	if (x <= -8.8e+163)
		tmp = t_1;
	elseif (x <= -1.8e+81)
		tmp = Float64(-0.5 / Float64(t / z));
	elseif (x <= -3.5e+43)
		tmp = t_1;
	else
		tmp = Float64(z * Float64(-0.5 / t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (0.5 / t);
	tmp = 0.0;
	if (x <= -8.8e+163)
		tmp = t_1;
	elseif (x <= -1.8e+81)
		tmp = -0.5 / (t / z);
	elseif (x <= -3.5e+43)
		tmp = t_1;
	else
		tmp = z * (-0.5 / t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.8e+163], t$95$1, If[LessEqual[x, -1.8e+81], N[(-0.5 / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.5e+43], t$95$1, N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \frac{0.5}{t}\\
\mathbf{if}\;x \leq -8.8 \cdot 10^{+163}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -1.8 \cdot 10^{+81}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z}}\\

\mathbf{elif}\;x \leq -3.5 \cdot 10^{+43}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -8.79999999999999945e163 or -1.80000000000000003e81 < x < -3.5000000000000001e43

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Taylor expanded in y around 0 97.4%

      \[\leadsto \color{blue}{0.5 \cdot \frac{y}{t} + 0.5 \cdot \frac{x - z}{t}} \]
    3. Taylor expanded in x around inf 90.1%

      \[\leadsto \color{blue}{0.5 \cdot \frac{x}{t}} \]
    4. Step-by-step derivation
      1. associate-*r/90.1%

        \[\leadsto \color{blue}{\frac{0.5 \cdot x}{t}} \]
      2. associate-/l*89.6%

        \[\leadsto \color{blue}{\frac{0.5}{\frac{t}{x}}} \]
    5. Simplified89.6%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{t}{x}}} \]
    6. Step-by-step derivation
      1. associate-/r/89.8%

        \[\leadsto \color{blue}{\frac{0.5}{t} \cdot x} \]
    7. Applied egg-rr89.8%

      \[\leadsto \color{blue}{\frac{0.5}{t} \cdot x} \]

    if -8.79999999999999945e163 < x < -1.80000000000000003e81

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.1%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.1%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.1%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.1%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.1%

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

      \[\leadsto \frac{-0.5}{t} \cdot \color{blue}{z} \]
    5. Step-by-step derivation
      1. associate-*l/35.9%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot z}{t}} \]
      2. associate-/l*35.6%

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{t}{z}}} \]
    6. Applied egg-rr35.6%

      \[\leadsto \color{blue}{\frac{-0.5}{\frac{t}{z}}} \]

    if -3.5000000000000001e43 < x

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.7%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.7%

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

      \[\leadsto \frac{-0.5}{t} \cdot \color{blue}{z} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification52.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.8 \cdot 10^{+163}:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{+81}:\\ \;\;\;\;\frac{-0.5}{\frac{t}{z}}\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{+43}:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{-0.5}{t}\\ \end{array} \]

Alternative 9: 82.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+104} \lor \neg \left(z \leq 2.4 \cdot 10^{+76}\right):\\
\;\;\;\;\frac{z}{\frac{t}{-0.5}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.20000000000000001e104 or 2.4e76 < z

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.8%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.8%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.8%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.8%

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{z}{t}} \]
    5. Step-by-step derivation
      1. associate-*r/73.8%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot z}{t}} \]
      2. *-commutative73.8%

        \[\leadsto \frac{\color{blue}{z \cdot -0.5}}{t} \]
      3. associate-/l*73.8%

        \[\leadsto \color{blue}{\frac{z}{\frac{t}{-0.5}}} \]
    6. Simplified73.8%

      \[\leadsto \color{blue}{\frac{z}{\frac{t}{-0.5}}} \]

    if -5.20000000000000001e104 < z < 2.4e76

    1. Initial program 100.0%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
      3. neg-sub0100.0%

        \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
      4. associate-+l-100.0%

        \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      5. sub0-neg100.0%

        \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      6. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
      7. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
      8. *-commutative99.7%

        \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
      9. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
    3. Simplified99.7%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{y + x}{t}} \]
    5. Step-by-step derivation
      1. *-commutative81.8%

        \[\leadsto \color{blue}{\frac{y + x}{t} \cdot 0.5} \]
      2. +-commutative81.8%

        \[\leadsto \frac{\color{blue}{x + y}}{t} \cdot 0.5 \]
      3. associate-*l/81.8%

        \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot 0.5}{t}} \]
      4. associate-*r/81.6%

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

        \[\leadsto \color{blue}{\left(y + x\right)} \cdot \frac{0.5}{t} \]
    6. Simplified81.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{+104} \lor \neg \left(z \leq 2.4 \cdot 10^{+76}\right):\\ \;\;\;\;\frac{z}{\frac{t}{-0.5}}\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\ \end{array} \]

Alternative 10: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{-0.5}{t} \cdot \left(z - \left(x + y\right)\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* (/ -0.5 t) (- z (+ x y))))
double code(double x, double y, double z, double t) {
	return (-0.5 / t) * (z - (x + y));
}
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 = ((-0.5d0) / t) * (z - (x + y))
end function
public static double code(double x, double y, double z, double t) {
	return (-0.5 / t) * (z - (x + y));
}
def code(x, y, z, t):
	return (-0.5 / t) * (z - (x + y))
function code(x, y, z, t)
	return Float64(Float64(-0.5 / t) * Float64(z - Float64(x + y)))
end
function tmp = code(x, y, z, t)
	tmp = (-0.5 / t) * (z - (x + y));
end
code[x_, y_, z_, t_] := N[(N[(-0.5 / t), $MachinePrecision] * N[(z - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{-0.5}{t} \cdot \left(z - \left(x + y\right)\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
  2. Step-by-step derivation
    1. sub-neg100.0%

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

      \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
    3. neg-sub0100.0%

      \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
    4. associate-+l-100.0%

      \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
    5. sub0-neg100.0%

      \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
    6. neg-mul-1100.0%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
    7. associate-*l/99.7%

      \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
    8. *-commutative99.7%

      \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
    9. associate-/r*99.7%

      \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
    10. metadata-eval99.7%

      \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
  3. Simplified99.7%

    \[\leadsto \color{blue}{\frac{-0.5}{t} \cdot \left(z - \left(x + y\right)\right)} \]
  4. Final simplification99.7%

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

Alternative 11: 37.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ z \cdot \frac{-0.5}{t} \end{array} \]
(FPCore (x y z t) :precision binary64 (* z (/ -0.5 t)))
double code(double x, double y, double z, double t) {
	return z * (-0.5 / t);
}
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 = z * ((-0.5d0) / t)
end function
public static double code(double x, double y, double z, double t) {
	return z * (-0.5 / t);
}
def code(x, y, z, t):
	return z * (-0.5 / t)
function code(x, y, z, t)
	return Float64(z * Float64(-0.5 / t))
end
function tmp = code(x, y, z, t)
	tmp = z * (-0.5 / t);
end
code[x_, y_, z_, t_] := N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
z \cdot \frac{-0.5}{t}
\end{array}
Derivation
  1. Initial program 100.0%

    \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
  2. Step-by-step derivation
    1. sub-neg100.0%

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

      \[\leadsto \frac{\color{blue}{\left(-z\right) + \left(x + y\right)}}{t \cdot 2} \]
    3. neg-sub0100.0%

      \[\leadsto \frac{\color{blue}{\left(0 - z\right)} + \left(x + y\right)}{t \cdot 2} \]
    4. associate-+l-100.0%

      \[\leadsto \frac{\color{blue}{0 - \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
    5. sub0-neg100.0%

      \[\leadsto \frac{\color{blue}{-\left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
    6. neg-mul-1100.0%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(z - \left(x + y\right)\right)}}{t \cdot 2} \]
    7. associate-*l/99.7%

      \[\leadsto \color{blue}{\frac{-1}{t \cdot 2} \cdot \left(z - \left(x + y\right)\right)} \]
    8. *-commutative99.7%

      \[\leadsto \frac{-1}{\color{blue}{2 \cdot t}} \cdot \left(z - \left(x + y\right)\right) \]
    9. associate-/r*99.7%

      \[\leadsto \color{blue}{\frac{\frac{-1}{2}}{t}} \cdot \left(z - \left(x + y\right)\right) \]
    10. metadata-eval99.7%

      \[\leadsto \frac{\color{blue}{-0.5}}{t} \cdot \left(z - \left(x + y\right)\right) \]
  3. Simplified99.7%

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

    \[\leadsto \frac{-0.5}{t} \cdot \color{blue}{z} \]
  5. Final simplification41.0%

    \[\leadsto z \cdot \frac{-0.5}{t} \]

Reproduce

?
herbie shell --seed 2023192 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, B"
  :precision binary64
  (/ (- (+ x y) z) (* t 2.0)))