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

Percentage Accurate: 99.9% → 99.9%
Time: 7.6s
Alternatives: 10
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 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: 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. Add Preprocessing
  3. Final simplification100.0%

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

Alternative 2: 81.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+116} \lor \neg \left(z \leq 6.6 \cdot 10^{+164}\right):\\
\;\;\;\;\frac{z}{t \cdot -2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.9000000000000001e116 or 6.59999999999999991e164 < z

    1. Initial program 99.9%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. *-lft-identity99.9%

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(\left(x + y\right) - z\right)}}{-1 \cdot \left(t \cdot 2\right)} \]
      5. sub-neg99.9%

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

        \[\leadsto \frac{-\color{blue}{\left(\left(-z\right) + \left(x + y\right)\right)}}{-1 \cdot \left(t \cdot 2\right)} \]
      7. distribute-neg-in99.9%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(z - y\right) - x}{t \cdot -2}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 77.2%

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

    if -2.9000000000000001e116 < z < 6.59999999999999991e164

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(\left(x + y\right) - z\right) \cdot -1}}{-1 \cdot \left(t \cdot 2\right)} \]
      5. times-frac99.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
      14. /-rgt-identity99.6%

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

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

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

        \[\leadsto \color{blue}{\left(z + \left(-\left(x + y\right)\right)\right)} \cdot \frac{-1}{t \cdot 2} \]
      18. sub-neg99.6%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.9 \cdot 10^{+116} \lor \neg \left(z \leq 6.6 \cdot 10^{+164}\right):\\ \;\;\;\;\frac{z}{t \cdot -2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x + y}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 47.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.22 \cdot 10^{-172}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\

\mathbf{elif}\;y \leq 2 \cdot 10^{+52}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.22e-172

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
      14. /-rgt-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.22e-172 < y < 2e52

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
      14. /-rgt-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e52 < y

    1. Initial program 99.9%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. *-lft-identity99.9%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(\left(x + y\right) - z\right) \cdot -1}}{-1 \cdot \left(t \cdot 2\right)} \]
      5. times-frac99.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
      14. /-rgt-identity99.6%

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

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

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

        \[\leadsto \color{blue}{\left(z + \left(-\left(x + y\right)\right)\right)} \cdot \frac{-1}{t \cdot 2} \]
      18. sub-neg99.6%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.22 \cdot 10^{-172}:\\ \;\;\;\;0.5 \cdot \frac{x}{t}\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+52}:\\ \;\;\;\;z \cdot \frac{-0.5}{t}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 47.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{-179}:\\ \;\;\;\;0.5 \cdot \frac{x}{t}\\ \mathbf{elif}\;y \leq 1.95 \cdot 10^{+52}:\\ \;\;\;\;\frac{z}{t \cdot -2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -1.5e-179)
   (* 0.5 (/ x t))
   (if (<= y 1.95e+52) (/ z (* t -2.0)) (* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.5e-179) {
		tmp = 0.5 * (x / t);
	} else if (y <= 1.95e+52) {
		tmp = z / (t * -2.0);
	} else {
		tmp = 0.5 * (y / t);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= (-1.5d-179)) then
        tmp = 0.5d0 * (x / t)
    else if (y <= 1.95d+52) then
        tmp = z / (t * (-2.0d0))
    else
        tmp = 0.5d0 * (y / t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.5e-179) {
		tmp = 0.5 * (x / t);
	} else if (y <= 1.95e+52) {
		tmp = z / (t * -2.0);
	} else {
		tmp = 0.5 * (y / t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -1.5e-179:
		tmp = 0.5 * (x / t)
	elif y <= 1.95e+52:
		tmp = z / (t * -2.0)
	else:
		tmp = 0.5 * (y / t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -1.5e-179)
		tmp = Float64(0.5 * Float64(x / t));
	elseif (y <= 1.95e+52)
		tmp = Float64(z / Float64(t * -2.0));
	else
		tmp = Float64(0.5 * Float64(y / t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -1.5e-179)
		tmp = 0.5 * (x / t);
	elseif (y <= 1.95e+52)
		tmp = z / (t * -2.0);
	else
		tmp = 0.5 * (y / t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.5e-179], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.95e+52], N[(z / N[(t * -2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{-179}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\

\mathbf{elif}\;y \leq 1.95 \cdot 10^{+52}:\\
\;\;\;\;\frac{z}{t \cdot -2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.50000000000000003e-179

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
      14. /-rgt-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.50000000000000003e-179 < y < 1.95e52

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(z - y\right) - x}{t \cdot -2}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 49.0%

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

    if 1.95e52 < y

    1. Initial program 99.9%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. *-lft-identity99.9%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(\left(x + y\right) - z\right) \cdot -1}}{-1 \cdot \left(t \cdot 2\right)} \]
      5. times-frac99.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
      14. /-rgt-identity99.6%

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

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

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

        \[\leadsto \color{blue}{\left(z + \left(-\left(x + y\right)\right)\right)} \cdot \frac{-1}{t \cdot 2} \]
      18. sub-neg99.6%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{-179}:\\ \;\;\;\;0.5 \cdot \frac{x}{t}\\ \mathbf{elif}\;y \leq 1.95 \cdot 10^{+52}:\\ \;\;\;\;\frac{z}{t \cdot -2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 68.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -2 \cdot 10^{-241}:\\
\;\;\;\;\frac{z - x}{t \cdot -2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x y) < -1.9999999999999999e-241

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(z - y\right) - x}{t \cdot -2}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 62.9%

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

    if -1.9999999999999999e-241 < (+.f64 x y)

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
      14. /-rgt-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(z - y\right)}{t}} \]
      2. associate-*l/67.1%

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

        \[\leadsto \color{blue}{\left(z - y\right) \cdot \frac{-0.5}{t}} \]
    7. Simplified67.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + y \leq -2 \cdot 10^{-241}:\\ \;\;\;\;\frac{z - x}{t \cdot -2}\\ \mathbf{else}:\\ \;\;\;\;\left(z - y\right) \cdot \frac{-0.5}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 68.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-192}:\\
\;\;\;\;\frac{z - x}{t \cdot -2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x y) < -5.0000000000000001e-192

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(z - y\right) - x}{t \cdot -2}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 62.2%

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

    if -5.0000000000000001e-192 < (+.f64 x y)

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(z - y\right) - x}{t \cdot -2}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 67.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + y \leq -5 \cdot 10^{-192}:\\ \;\;\;\;\frac{z - x}{t \cdot -2}\\ \mathbf{else}:\\ \;\;\;\;\frac{z - y}{t \cdot -2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 78.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{+19}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.5e19

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
      14. /-rgt-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.5e19 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
      14. /-rgt-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(z - y\right)}{t}} \]
      2. associate-*l/74.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{+19}:\\ \;\;\;\;0.5 \cdot \frac{x + y}{t}\\ \mathbf{else}:\\ \;\;\;\;\left(z - y\right) \cdot \frac{-0.5}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 45.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{+33}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.5999999999999997e33

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
      14. /-rgt-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.5999999999999997e33 < y

    1. Initial program 99.9%

      \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
    2. Step-by-step derivation
      1. *-lft-identity99.9%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(\left(x + y\right) - z\right) \cdot -1}}{-1 \cdot \left(t \cdot 2\right)} \]
      5. times-frac99.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
      14. /-rgt-identity99.6%

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

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

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

        \[\leadsto \color{blue}{\left(z + \left(-\left(x + y\right)\right)\right)} \cdot \frac{-1}{t \cdot 2} \]
      18. sub-neg99.6%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.6 \cdot 10^{+33}:\\ \;\;\;\;0.5 \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 99.7% accurate, 1.0× speedup?

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

\\
\left(\left(z - y\right) - x\right) \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. *-lft-identity100.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
    14. /-rgt-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(\left(z - y\right) - x\right) \cdot \frac{-0.5}{t} \]
  6. Add Preprocessing

Alternative 10: 36.5% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(0 - \frac{\left(x + y\right) - z}{\color{blue}{1}}\right) \cdot \frac{-1}{t \cdot 2} \]
    14. /-rgt-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.5 \cdot \frac{x}{t} \]
  7. Add Preprocessing

Reproduce

?
herbie shell --seed 2024020 
(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)))