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

Percentage Accurate: 99.9% → 98.9%
Time: 6.3s
Alternatives: 11
Speedup: N/A×

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: 98.9% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x + y \leq -2 \cdot 10^{-208}:\\ \;\;\;\;\frac{x - z}{t} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{y - z}{2 \cdot t}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= (+ x y) -2e-208) (* (/ (- x z) t) 0.5) (/ (- y z) (* 2.0 t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x + y) <= -2e-208) {
		tmp = ((x - z) / t) * 0.5;
	} else {
		tmp = (y - z) / (2.0 * t);
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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-208)) then
        tmp = ((x - z) / t) * 0.5d0
    else
        tmp = (y - z) / (2.0d0 * t)
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x + y) <= -2e-208) {
		tmp = ((x - z) / t) * 0.5;
	} else {
		tmp = (y - z) / (2.0 * t);
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if (x + y) <= -2e-208:
		tmp = ((x - z) / t) * 0.5
	else:
		tmp = (y - z) / (2.0 * t)
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(x + y) <= -2e-208)
		tmp = Float64(Float64(Float64(x - z) / t) * 0.5);
	else
		tmp = Float64(Float64(y - z) / Float64(2.0 * t));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x + y) <= -2e-208)
		tmp = ((x - z) / t) * 0.5;
	else
		tmp = (y - z) / (2.0 * t);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -2e-208], N[(N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(y - z), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -2 \cdot 10^{-208}:\\
\;\;\;\;\frac{x - z}{t} \cdot 0.5\\

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


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

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{x - z}{t}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{x - z}{t} \cdot \frac{1}{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{x - z}{t} \cdot \frac{1}{2}} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x - z}{t}} \cdot \frac{1}{2} \]
      4. lower--.f6462.9

        \[\leadsto \frac{\color{blue}{x - z}}{t} \cdot 0.5 \]
    5. Applied rewrites62.9%

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

    if -2.0000000000000002e-208 < (+.f64 x y)

    1. Initial program 100.0%

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

      \[\leadsto \frac{\color{blue}{x + y}}{t \cdot 2} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{y + x}}{t \cdot 2} \]
      2. lower-+.f6461.9

        \[\leadsto \frac{\color{blue}{y + x}}{t \cdot 2} \]
    5. Applied rewrites61.9%

      \[\leadsto \frac{\color{blue}{y + x}}{t \cdot 2} \]
    6. Taylor expanded in x around 0

      \[\leadsto \frac{\color{blue}{y - z}}{t \cdot 2} \]
    7. Step-by-step derivation
      1. lower--.f6470.6

        \[\leadsto \frac{\color{blue}{y - z}}{t \cdot 2} \]
    8. Applied rewrites70.6%

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

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

Alternative 2: 76.8% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x + y \leq -0.005:\\ \;\;\;\;\frac{x}{t} \cdot 0.5\\ \mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\ \;\;\;\;\frac{-z}{2 \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot 0.5}{t}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= (+ x y) -0.005)
   (* (/ x t) 0.5)
   (if (<= (+ x y) 4e+35) (/ (- z) (* 2.0 t)) (/ (* y 0.5) t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x + y) <= -0.005) {
		tmp = (x / t) * 0.5;
	} else if ((x + y) <= 4e+35) {
		tmp = -z / (2.0 * t);
	} else {
		tmp = (y * 0.5) / t;
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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) <= (-0.005d0)) then
        tmp = (x / t) * 0.5d0
    else if ((x + y) <= 4d+35) then
        tmp = -z / (2.0d0 * t)
    else
        tmp = (y * 0.5d0) / t
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x + y) <= -0.005) {
		tmp = (x / t) * 0.5;
	} else if ((x + y) <= 4e+35) {
		tmp = -z / (2.0 * t);
	} else {
		tmp = (y * 0.5) / t;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if (x + y) <= -0.005:
		tmp = (x / t) * 0.5
	elif (x + y) <= 4e+35:
		tmp = -z / (2.0 * t)
	else:
		tmp = (y * 0.5) / t
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(x + y) <= -0.005)
		tmp = Float64(Float64(x / t) * 0.5);
	elseif (Float64(x + y) <= 4e+35)
		tmp = Float64(Float64(-z) / Float64(2.0 * t));
	else
		tmp = Float64(Float64(y * 0.5) / t);
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x + y) <= -0.005)
		tmp = (x / t) * 0.5;
	elseif ((x + y) <= 4e+35)
		tmp = -z / (2.0 * t);
	else
		tmp = (y * 0.5) / t;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.005], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 4e+35], N[((-z) / N[(2.0 * t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -0.005:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\

\mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\
\;\;\;\;\frac{-z}{2 \cdot t}\\

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


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

    1. Initial program 99.1%

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{t}} \]
    4. Step-by-step derivation
      1. *-lft-identityN/A

        \[\leadsto \frac{-1}{2} \cdot \frac{\color{blue}{1 \cdot z}}{t} \]
      2. associate-*l/N/A

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot z\right)} \]
      3. associate-*l*N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{1}{t}\right) \cdot z} \]
      4. metadata-evalN/A

        \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot \frac{1}{t}\right) \cdot z \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right)} \cdot z \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right) \cdot z} \]
      7. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{1}{2} \cdot 1}{t}}\right)\right) \cdot z \]
      8. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{1}{2}}}{t}\right)\right) \cdot z \]
      9. distribute-neg-fracN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{t}} \cdot z \]
      10. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{\frac{-1}{2}}}{t} \cdot z \]
      11. lower-/.f6426.0

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

      \[\leadsto \color{blue}{\frac{-0.5}{t} \cdot z} \]
    6. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{x}{t}} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{x}{t} \cdot \frac{1}{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{t} \cdot \frac{1}{2}} \]
      3. lower-/.f6435.5

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

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

    if -0.0050000000000000001 < (+.f64 x y) < 3.9999999999999999e35

    1. Initial program 100.0%

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

      \[\leadsto \frac{\color{blue}{-1 \cdot z}}{t \cdot 2} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(z\right)}}{t \cdot 2} \]
      2. lower-neg.f6473.7

        \[\leadsto \frac{\color{blue}{-z}}{t \cdot 2} \]
    5. Applied rewrites73.7%

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

    if 3.9999999999999999e35 < (+.f64 x y)

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{y}{t}} \]
    4. Step-by-step derivation
      1. *-lft-identityN/A

        \[\leadsto \frac{1}{2} \cdot \frac{\color{blue}{1 \cdot y}}{t} \]
      2. associate-*l/N/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot y\right)} \]
      3. associate-*l*N/A

        \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot y} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot y} \]
      5. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot 1}{t}} \cdot y \]
      6. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{t} \cdot y \]
      7. lower-/.f6443.0

        \[\leadsto \color{blue}{\frac{0.5}{t}} \cdot y \]
    5. Applied rewrites43.0%

      \[\leadsto \color{blue}{\frac{0.5}{t} \cdot y} \]
    6. Step-by-step derivation
      1. Applied rewrites43.1%

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

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

    Alternative 3: 76.8% accurate, 0.7× speedup?

    \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x + y \leq -0.005:\\ \;\;\;\;\frac{x}{t} \cdot 0.5\\ \mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\ \;\;\;\;\frac{-0.5 \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot 0.5}{t}\\ \end{array} \end{array} \]
    NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
    (FPCore (x y z t)
     :precision binary64
     (if (<= (+ x y) -0.005)
       (* (/ x t) 0.5)
       (if (<= (+ x y) 4e+35) (/ (* -0.5 z) t) (/ (* y 0.5) t))))
    assert(x < y && y < z && z < t);
    double code(double x, double y, double z, double t) {
    	double tmp;
    	if ((x + y) <= -0.005) {
    		tmp = (x / t) * 0.5;
    	} else if ((x + y) <= 4e+35) {
    		tmp = (-0.5 * z) / t;
    	} else {
    		tmp = (y * 0.5) / t;
    	}
    	return tmp;
    }
    
    NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
    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) <= (-0.005d0)) then
            tmp = (x / t) * 0.5d0
        else if ((x + y) <= 4d+35) then
            tmp = ((-0.5d0) * z) / t
        else
            tmp = (y * 0.5d0) / t
        end if
        code = tmp
    end function
    
    assert x < y && y < z && z < t;
    public static double code(double x, double y, double z, double t) {
    	double tmp;
    	if ((x + y) <= -0.005) {
    		tmp = (x / t) * 0.5;
    	} else if ((x + y) <= 4e+35) {
    		tmp = (-0.5 * z) / t;
    	} else {
    		tmp = (y * 0.5) / t;
    	}
    	return tmp;
    }
    
    [x, y, z, t] = sort([x, y, z, t])
    def code(x, y, z, t):
    	tmp = 0
    	if (x + y) <= -0.005:
    		tmp = (x / t) * 0.5
    	elif (x + y) <= 4e+35:
    		tmp = (-0.5 * z) / t
    	else:
    		tmp = (y * 0.5) / t
    	return tmp
    
    x, y, z, t = sort([x, y, z, t])
    function code(x, y, z, t)
    	tmp = 0.0
    	if (Float64(x + y) <= -0.005)
    		tmp = Float64(Float64(x / t) * 0.5);
    	elseif (Float64(x + y) <= 4e+35)
    		tmp = Float64(Float64(-0.5 * z) / t);
    	else
    		tmp = Float64(Float64(y * 0.5) / t);
    	end
    	return tmp
    end
    
    x, y, z, t = num2cell(sort([x, y, z, t])){:}
    function tmp_2 = code(x, y, z, t)
    	tmp = 0.0;
    	if ((x + y) <= -0.005)
    		tmp = (x / t) * 0.5;
    	elseif ((x + y) <= 4e+35)
    		tmp = (-0.5 * z) / t;
    	else
    		tmp = (y * 0.5) / t;
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
    code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.005], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 4e+35], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]]
    
    \begin{array}{l}
    [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;x + y \leq -0.005:\\
    \;\;\;\;\frac{x}{t} \cdot 0.5\\
    
    \mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\
    \;\;\;\;\frac{-0.5 \cdot z}{t}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{y \cdot 0.5}{t}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (+.f64 x y) < -0.0050000000000000001

      1. Initial program 99.1%

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

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{t}} \]
      4. Step-by-step derivation
        1. *-lft-identityN/A

          \[\leadsto \frac{-1}{2} \cdot \frac{\color{blue}{1 \cdot z}}{t} \]
        2. associate-*l/N/A

          \[\leadsto \frac{-1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot z\right)} \]
        3. associate-*l*N/A

          \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{1}{t}\right) \cdot z} \]
        4. metadata-evalN/A

          \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot \frac{1}{t}\right) \cdot z \]
        5. distribute-lft-neg-inN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right)} \cdot z \]
        6. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right) \cdot z} \]
        7. associate-*r/N/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{1}{2} \cdot 1}{t}}\right)\right) \cdot z \]
        8. metadata-evalN/A

          \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{1}{2}}}{t}\right)\right) \cdot z \]
        9. distribute-neg-fracN/A

          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{t}} \cdot z \]
        10. metadata-evalN/A

          \[\leadsto \frac{\color{blue}{\frac{-1}{2}}}{t} \cdot z \]
        11. lower-/.f6426.0

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

        \[\leadsto \color{blue}{\frac{-0.5}{t} \cdot z} \]
      6. Taylor expanded in x around inf

        \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{x}{t}} \]
      7. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \color{blue}{\frac{x}{t} \cdot \frac{1}{2}} \]
        2. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{x}{t} \cdot \frac{1}{2}} \]
        3. lower-/.f6435.5

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

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

      if -0.0050000000000000001 < (+.f64 x y) < 3.9999999999999999e35

      1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{t}} \]
      4. Step-by-step derivation
        1. *-lft-identityN/A

          \[\leadsto \frac{-1}{2} \cdot \frac{\color{blue}{1 \cdot z}}{t} \]
        2. associate-*l/N/A

          \[\leadsto \frac{-1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot z\right)} \]
        3. associate-*l*N/A

          \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{1}{t}\right) \cdot z} \]
        4. metadata-evalN/A

          \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot \frac{1}{t}\right) \cdot z \]
        5. distribute-lft-neg-inN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right)} \cdot z \]
        6. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right) \cdot z} \]
        7. associate-*r/N/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{1}{2} \cdot 1}{t}}\right)\right) \cdot z \]
        8. metadata-evalN/A

          \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{1}{2}}}{t}\right)\right) \cdot z \]
        9. distribute-neg-fracN/A

          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{t}} \cdot z \]
        10. metadata-evalN/A

          \[\leadsto \frac{\color{blue}{\frac{-1}{2}}}{t} \cdot z \]
        11. lower-/.f6473.4

          \[\leadsto \color{blue}{\frac{-0.5}{t}} \cdot z \]
      5. Applied rewrites73.4%

        \[\leadsto \color{blue}{\frac{-0.5}{t} \cdot z} \]
      6. Step-by-step derivation
        1. Applied rewrites73.7%

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

        if 3.9999999999999999e35 < (+.f64 x y)

        1. Initial program 100.0%

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

          \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{y}{t}} \]
        4. Step-by-step derivation
          1. *-lft-identityN/A

            \[\leadsto \frac{1}{2} \cdot \frac{\color{blue}{1 \cdot y}}{t} \]
          2. associate-*l/N/A

            \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot y\right)} \]
          3. associate-*l*N/A

            \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot y} \]
          4. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot y} \]
          5. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot 1}{t}} \cdot y \]
          6. metadata-evalN/A

            \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{t} \cdot y \]
          7. lower-/.f6443.0

            \[\leadsto \color{blue}{\frac{0.5}{t}} \cdot y \]
        5. Applied rewrites43.0%

          \[\leadsto \color{blue}{\frac{0.5}{t} \cdot y} \]
        6. Step-by-step derivation
          1. Applied rewrites43.1%

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

        Alternative 4: 76.7% accurate, 0.7× speedup?

        \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x + y \leq -0.005:\\ \;\;\;\;\frac{x}{t} \cdot 0.5\\ \mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\ \;\;\;\;\frac{-0.5 \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{0.5}{t}\\ \end{array} \end{array} \]
        NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
        (FPCore (x y z t)
         :precision binary64
         (if (<= (+ x y) -0.005)
           (* (/ x t) 0.5)
           (if (<= (+ x y) 4e+35) (/ (* -0.5 z) t) (* y (/ 0.5 t)))))
        assert(x < y && y < z && z < t);
        double code(double x, double y, double z, double t) {
        	double tmp;
        	if ((x + y) <= -0.005) {
        		tmp = (x / t) * 0.5;
        	} else if ((x + y) <= 4e+35) {
        		tmp = (-0.5 * z) / t;
        	} else {
        		tmp = y * (0.5 / t);
        	}
        	return tmp;
        }
        
        NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
        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) <= (-0.005d0)) then
                tmp = (x / t) * 0.5d0
            else if ((x + y) <= 4d+35) then
                tmp = ((-0.5d0) * z) / t
            else
                tmp = y * (0.5d0 / t)
            end if
            code = tmp
        end function
        
        assert x < y && y < z && z < t;
        public static double code(double x, double y, double z, double t) {
        	double tmp;
        	if ((x + y) <= -0.005) {
        		tmp = (x / t) * 0.5;
        	} else if ((x + y) <= 4e+35) {
        		tmp = (-0.5 * z) / t;
        	} else {
        		tmp = y * (0.5 / t);
        	}
        	return tmp;
        }
        
        [x, y, z, t] = sort([x, y, z, t])
        def code(x, y, z, t):
        	tmp = 0
        	if (x + y) <= -0.005:
        		tmp = (x / t) * 0.5
        	elif (x + y) <= 4e+35:
        		tmp = (-0.5 * z) / t
        	else:
        		tmp = y * (0.5 / t)
        	return tmp
        
        x, y, z, t = sort([x, y, z, t])
        function code(x, y, z, t)
        	tmp = 0.0
        	if (Float64(x + y) <= -0.005)
        		tmp = Float64(Float64(x / t) * 0.5);
        	elseif (Float64(x + y) <= 4e+35)
        		tmp = Float64(Float64(-0.5 * z) / t);
        	else
        		tmp = Float64(y * Float64(0.5 / t));
        	end
        	return tmp
        end
        
        x, y, z, t = num2cell(sort([x, y, z, t])){:}
        function tmp_2 = code(x, y, z, t)
        	tmp = 0.0;
        	if ((x + y) <= -0.005)
        		tmp = (x / t) * 0.5;
        	elseif ((x + y) <= 4e+35)
        		tmp = (-0.5 * z) / t;
        	else
        		tmp = y * (0.5 / t);
        	end
        	tmp_2 = tmp;
        end
        
        NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
        code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.005], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 4e+35], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;x + y \leq -0.005:\\
        \;\;\;\;\frac{x}{t} \cdot 0.5\\
        
        \mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\
        \;\;\;\;\frac{-0.5 \cdot z}{t}\\
        
        \mathbf{else}:\\
        \;\;\;\;y \cdot \frac{0.5}{t}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (+.f64 x y) < -0.0050000000000000001

          1. Initial program 99.1%

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

            \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{t}} \]
          4. Step-by-step derivation
            1. *-lft-identityN/A

              \[\leadsto \frac{-1}{2} \cdot \frac{\color{blue}{1 \cdot z}}{t} \]
            2. associate-*l/N/A

              \[\leadsto \frac{-1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot z\right)} \]
            3. associate-*l*N/A

              \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{1}{t}\right) \cdot z} \]
            4. metadata-evalN/A

              \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot \frac{1}{t}\right) \cdot z \]
            5. distribute-lft-neg-inN/A

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right)} \cdot z \]
            6. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right) \cdot z} \]
            7. associate-*r/N/A

              \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{1}{2} \cdot 1}{t}}\right)\right) \cdot z \]
            8. metadata-evalN/A

              \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{1}{2}}}{t}\right)\right) \cdot z \]
            9. distribute-neg-fracN/A

              \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{t}} \cdot z \]
            10. metadata-evalN/A

              \[\leadsto \frac{\color{blue}{\frac{-1}{2}}}{t} \cdot z \]
            11. lower-/.f6426.0

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

            \[\leadsto \color{blue}{\frac{-0.5}{t} \cdot z} \]
          6. Taylor expanded in x around inf

            \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{x}{t}} \]
          7. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\frac{x}{t} \cdot \frac{1}{2}} \]
            2. lower-*.f64N/A

              \[\leadsto \color{blue}{\frac{x}{t} \cdot \frac{1}{2}} \]
            3. lower-/.f6435.5

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

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

          if -0.0050000000000000001 < (+.f64 x y) < 3.9999999999999999e35

          1. Initial program 100.0%

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

            \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{t}} \]
          4. Step-by-step derivation
            1. *-lft-identityN/A

              \[\leadsto \frac{-1}{2} \cdot \frac{\color{blue}{1 \cdot z}}{t} \]
            2. associate-*l/N/A

              \[\leadsto \frac{-1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot z\right)} \]
            3. associate-*l*N/A

              \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{1}{t}\right) \cdot z} \]
            4. metadata-evalN/A

              \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot \frac{1}{t}\right) \cdot z \]
            5. distribute-lft-neg-inN/A

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right)} \cdot z \]
            6. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right) \cdot z} \]
            7. associate-*r/N/A

              \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{1}{2} \cdot 1}{t}}\right)\right) \cdot z \]
            8. metadata-evalN/A

              \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{1}{2}}}{t}\right)\right) \cdot z \]
            9. distribute-neg-fracN/A

              \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{t}} \cdot z \]
            10. metadata-evalN/A

              \[\leadsto \frac{\color{blue}{\frac{-1}{2}}}{t} \cdot z \]
            11. lower-/.f6473.4

              \[\leadsto \color{blue}{\frac{-0.5}{t}} \cdot z \]
          5. Applied rewrites73.4%

            \[\leadsto \color{blue}{\frac{-0.5}{t} \cdot z} \]
          6. Step-by-step derivation
            1. Applied rewrites73.7%

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

            if 3.9999999999999999e35 < (+.f64 x y)

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{y}{t}} \]
            4. Step-by-step derivation
              1. *-lft-identityN/A

                \[\leadsto \frac{1}{2} \cdot \frac{\color{blue}{1 \cdot y}}{t} \]
              2. associate-*l/N/A

                \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot y\right)} \]
              3. associate-*l*N/A

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot y} \]
              4. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot y} \]
              5. associate-*r/N/A

                \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot 1}{t}} \cdot y \]
              6. metadata-evalN/A

                \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{t} \cdot y \]
              7. lower-/.f6443.0

                \[\leadsto \color{blue}{\frac{0.5}{t}} \cdot y \]
            5. Applied rewrites43.0%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;x + y \leq -0.005:\\ \;\;\;\;\frac{x}{t} \cdot 0.5\\ \mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\ \;\;\;\;\frac{-0.5 \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{0.5}{t}\\ \end{array} \]
          9. Add Preprocessing

          Alternative 5: 76.7% accurate, 0.7× speedup?

          \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x + y \leq -0.005:\\ \;\;\;\;\frac{x}{t} \cdot 0.5\\ \mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\ \;\;\;\;\frac{-0.5}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{0.5}{t}\\ \end{array} \end{array} \]
          NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
          (FPCore (x y z t)
           :precision binary64
           (if (<= (+ x y) -0.005)
             (* (/ x t) 0.5)
             (if (<= (+ x y) 4e+35) (* (/ -0.5 t) z) (* y (/ 0.5 t)))))
          assert(x < y && y < z && z < t);
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((x + y) <= -0.005) {
          		tmp = (x / t) * 0.5;
          	} else if ((x + y) <= 4e+35) {
          		tmp = (-0.5 / t) * z;
          	} else {
          		tmp = y * (0.5 / t);
          	}
          	return tmp;
          }
          
          NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
          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) <= (-0.005d0)) then
                  tmp = (x / t) * 0.5d0
              else if ((x + y) <= 4d+35) then
                  tmp = ((-0.5d0) / t) * z
              else
                  tmp = y * (0.5d0 / t)
              end if
              code = tmp
          end function
          
          assert x < y && y < z && z < t;
          public static double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((x + y) <= -0.005) {
          		tmp = (x / t) * 0.5;
          	} else if ((x + y) <= 4e+35) {
          		tmp = (-0.5 / t) * z;
          	} else {
          		tmp = y * (0.5 / t);
          	}
          	return tmp;
          }
          
          [x, y, z, t] = sort([x, y, z, t])
          def code(x, y, z, t):
          	tmp = 0
          	if (x + y) <= -0.005:
          		tmp = (x / t) * 0.5
          	elif (x + y) <= 4e+35:
          		tmp = (-0.5 / t) * z
          	else:
          		tmp = y * (0.5 / t)
          	return tmp
          
          x, y, z, t = sort([x, y, z, t])
          function code(x, y, z, t)
          	tmp = 0.0
          	if (Float64(x + y) <= -0.005)
          		tmp = Float64(Float64(x / t) * 0.5);
          	elseif (Float64(x + y) <= 4e+35)
          		tmp = Float64(Float64(-0.5 / t) * z);
          	else
          		tmp = Float64(y * Float64(0.5 / t));
          	end
          	return tmp
          end
          
          x, y, z, t = num2cell(sort([x, y, z, t])){:}
          function tmp_2 = code(x, y, z, t)
          	tmp = 0.0;
          	if ((x + y) <= -0.005)
          		tmp = (x / t) * 0.5;
          	elseif ((x + y) <= 4e+35)
          		tmp = (-0.5 / t) * z;
          	else
          		tmp = y * (0.5 / t);
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
          code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.005], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 4e+35], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]
          
          \begin{array}{l}
          [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;x + y \leq -0.005:\\
          \;\;\;\;\frac{x}{t} \cdot 0.5\\
          
          \mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\
          \;\;\;\;\frac{-0.5}{t} \cdot z\\
          
          \mathbf{else}:\\
          \;\;\;\;y \cdot \frac{0.5}{t}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if (+.f64 x y) < -0.0050000000000000001

            1. Initial program 99.1%

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

              \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{t}} \]
            4. Step-by-step derivation
              1. *-lft-identityN/A

                \[\leadsto \frac{-1}{2} \cdot \frac{\color{blue}{1 \cdot z}}{t} \]
              2. associate-*l/N/A

                \[\leadsto \frac{-1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot z\right)} \]
              3. associate-*l*N/A

                \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{1}{t}\right) \cdot z} \]
              4. metadata-evalN/A

                \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot \frac{1}{t}\right) \cdot z \]
              5. distribute-lft-neg-inN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right)} \cdot z \]
              6. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right) \cdot z} \]
              7. associate-*r/N/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{1}{2} \cdot 1}{t}}\right)\right) \cdot z \]
              8. metadata-evalN/A

                \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{1}{2}}}{t}\right)\right) \cdot z \]
              9. distribute-neg-fracN/A

                \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{t}} \cdot z \]
              10. metadata-evalN/A

                \[\leadsto \frac{\color{blue}{\frac{-1}{2}}}{t} \cdot z \]
              11. lower-/.f6426.0

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

              \[\leadsto \color{blue}{\frac{-0.5}{t} \cdot z} \]
            6. Taylor expanded in x around inf

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{x}{t}} \]
            7. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \color{blue}{\frac{x}{t} \cdot \frac{1}{2}} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{x}{t} \cdot \frac{1}{2}} \]
              3. lower-/.f6435.5

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

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

            if -0.0050000000000000001 < (+.f64 x y) < 3.9999999999999999e35

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{t}} \]
            4. Step-by-step derivation
              1. *-lft-identityN/A

                \[\leadsto \frac{-1}{2} \cdot \frac{\color{blue}{1 \cdot z}}{t} \]
              2. associate-*l/N/A

                \[\leadsto \frac{-1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot z\right)} \]
              3. associate-*l*N/A

                \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{1}{t}\right) \cdot z} \]
              4. metadata-evalN/A

                \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot \frac{1}{t}\right) \cdot z \]
              5. distribute-lft-neg-inN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right)} \cdot z \]
              6. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right) \cdot z} \]
              7. associate-*r/N/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{1}{2} \cdot 1}{t}}\right)\right) \cdot z \]
              8. metadata-evalN/A

                \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{1}{2}}}{t}\right)\right) \cdot z \]
              9. distribute-neg-fracN/A

                \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{t}} \cdot z \]
              10. metadata-evalN/A

                \[\leadsto \frac{\color{blue}{\frac{-1}{2}}}{t} \cdot z \]
              11. lower-/.f6473.4

                \[\leadsto \color{blue}{\frac{-0.5}{t}} \cdot z \]
            5. Applied rewrites73.4%

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

            if 3.9999999999999999e35 < (+.f64 x y)

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{y}{t}} \]
            4. Step-by-step derivation
              1. *-lft-identityN/A

                \[\leadsto \frac{1}{2} \cdot \frac{\color{blue}{1 \cdot y}}{t} \]
              2. associate-*l/N/A

                \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot y\right)} \]
              3. associate-*l*N/A

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot y} \]
              4. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot y} \]
              5. associate-*r/N/A

                \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot 1}{t}} \cdot y \]
              6. metadata-evalN/A

                \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{t} \cdot y \]
              7. lower-/.f6443.0

                \[\leadsto \color{blue}{\frac{0.5}{t}} \cdot y \]
            5. Applied rewrites43.0%

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

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

          Alternative 6: 76.6% accurate, 0.7× speedup?

          \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x + y \leq -0.005:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\ \;\;\;\;\frac{-0.5}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{0.5}{t}\\ \end{array} \end{array} \]
          NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
          (FPCore (x y z t)
           :precision binary64
           (if (<= (+ x y) -0.005)
             (* x (/ 0.5 t))
             (if (<= (+ x y) 4e+35) (* (/ -0.5 t) z) (* y (/ 0.5 t)))))
          assert(x < y && y < z && z < t);
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((x + y) <= -0.005) {
          		tmp = x * (0.5 / t);
          	} else if ((x + y) <= 4e+35) {
          		tmp = (-0.5 / t) * z;
          	} else {
          		tmp = y * (0.5 / t);
          	}
          	return tmp;
          }
          
          NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
          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) <= (-0.005d0)) then
                  tmp = x * (0.5d0 / t)
              else if ((x + y) <= 4d+35) then
                  tmp = ((-0.5d0) / t) * z
              else
                  tmp = y * (0.5d0 / t)
              end if
              code = tmp
          end function
          
          assert x < y && y < z && z < t;
          public static double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((x + y) <= -0.005) {
          		tmp = x * (0.5 / t);
          	} else if ((x + y) <= 4e+35) {
          		tmp = (-0.5 / t) * z;
          	} else {
          		tmp = y * (0.5 / t);
          	}
          	return tmp;
          }
          
          [x, y, z, t] = sort([x, y, z, t])
          def code(x, y, z, t):
          	tmp = 0
          	if (x + y) <= -0.005:
          		tmp = x * (0.5 / t)
          	elif (x + y) <= 4e+35:
          		tmp = (-0.5 / t) * z
          	else:
          		tmp = y * (0.5 / t)
          	return tmp
          
          x, y, z, t = sort([x, y, z, t])
          function code(x, y, z, t)
          	tmp = 0.0
          	if (Float64(x + y) <= -0.005)
          		tmp = Float64(x * Float64(0.5 / t));
          	elseif (Float64(x + y) <= 4e+35)
          		tmp = Float64(Float64(-0.5 / t) * z);
          	else
          		tmp = Float64(y * Float64(0.5 / t));
          	end
          	return tmp
          end
          
          x, y, z, t = num2cell(sort([x, y, z, t])){:}
          function tmp_2 = code(x, y, z, t)
          	tmp = 0.0;
          	if ((x + y) <= -0.005)
          		tmp = x * (0.5 / t);
          	elseif ((x + y) <= 4e+35)
          		tmp = (-0.5 / t) * z;
          	else
          		tmp = y * (0.5 / t);
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
          code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.005], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 4e+35], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]
          
          \begin{array}{l}
          [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;x + y \leq -0.005:\\
          \;\;\;\;x \cdot \frac{0.5}{t}\\
          
          \mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\
          \;\;\;\;\frac{-0.5}{t} \cdot z\\
          
          \mathbf{else}:\\
          \;\;\;\;y \cdot \frac{0.5}{t}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if (+.f64 x y) < -0.0050000000000000001

            1. Initial program 99.1%

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

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{x}{t}} \]
            4. Step-by-step derivation
              1. *-lft-identityN/A

                \[\leadsto \frac{1}{2} \cdot \frac{\color{blue}{1 \cdot x}}{t} \]
              2. associate-*l/N/A

                \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot x\right)} \]
              3. associate-*l*N/A

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot x} \]
              4. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot x} \]
              5. associate-*r/N/A

                \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot 1}{t}} \cdot x \]
              6. metadata-evalN/A

                \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{t} \cdot x \]
              7. lower-/.f6435.4

                \[\leadsto \color{blue}{\frac{0.5}{t}} \cdot x \]
            5. Applied rewrites35.4%

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

            if -0.0050000000000000001 < (+.f64 x y) < 3.9999999999999999e35

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{t}} \]
            4. Step-by-step derivation
              1. *-lft-identityN/A

                \[\leadsto \frac{-1}{2} \cdot \frac{\color{blue}{1 \cdot z}}{t} \]
              2. associate-*l/N/A

                \[\leadsto \frac{-1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot z\right)} \]
              3. associate-*l*N/A

                \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{1}{t}\right) \cdot z} \]
              4. metadata-evalN/A

                \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot \frac{1}{t}\right) \cdot z \]
              5. distribute-lft-neg-inN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right)} \cdot z \]
              6. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right) \cdot z} \]
              7. associate-*r/N/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{1}{2} \cdot 1}{t}}\right)\right) \cdot z \]
              8. metadata-evalN/A

                \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{1}{2}}}{t}\right)\right) \cdot z \]
              9. distribute-neg-fracN/A

                \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{t}} \cdot z \]
              10. metadata-evalN/A

                \[\leadsto \frac{\color{blue}{\frac{-1}{2}}}{t} \cdot z \]
              11. lower-/.f6473.4

                \[\leadsto \color{blue}{\frac{-0.5}{t}} \cdot z \]
            5. Applied rewrites73.4%

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

            if 3.9999999999999999e35 < (+.f64 x y)

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{y}{t}} \]
            4. Step-by-step derivation
              1. *-lft-identityN/A

                \[\leadsto \frac{1}{2} \cdot \frac{\color{blue}{1 \cdot y}}{t} \]
              2. associate-*l/N/A

                \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot y\right)} \]
              3. associate-*l*N/A

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot y} \]
              4. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot y} \]
              5. associate-*r/N/A

                \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot 1}{t}} \cdot y \]
              6. metadata-evalN/A

                \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{t} \cdot y \]
              7. lower-/.f6443.0

                \[\leadsto \color{blue}{\frac{0.5}{t}} \cdot y \]
            5. Applied rewrites43.0%

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

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

          Alternative 7: 98.9% accurate, 0.8× speedup?

          \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x + y \leq -2 \cdot 10^{-208}:\\ \;\;\;\;\frac{x - z}{t} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{y - z}{t} \cdot 0.5\\ \end{array} \end{array} \]
          NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
          (FPCore (x y z t)
           :precision binary64
           (if (<= (+ x y) -2e-208) (* (/ (- x z) t) 0.5) (* (/ (- y z) t) 0.5)))
          assert(x < y && y < z && z < t);
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((x + y) <= -2e-208) {
          		tmp = ((x - z) / t) * 0.5;
          	} else {
          		tmp = ((y - z) / t) * 0.5;
          	}
          	return tmp;
          }
          
          NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
          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-208)) then
                  tmp = ((x - z) / t) * 0.5d0
              else
                  tmp = ((y - z) / t) * 0.5d0
              end if
              code = tmp
          end function
          
          assert x < y && y < z && z < t;
          public static double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((x + y) <= -2e-208) {
          		tmp = ((x - z) / t) * 0.5;
          	} else {
          		tmp = ((y - z) / t) * 0.5;
          	}
          	return tmp;
          }
          
          [x, y, z, t] = sort([x, y, z, t])
          def code(x, y, z, t):
          	tmp = 0
          	if (x + y) <= -2e-208:
          		tmp = ((x - z) / t) * 0.5
          	else:
          		tmp = ((y - z) / t) * 0.5
          	return tmp
          
          x, y, z, t = sort([x, y, z, t])
          function code(x, y, z, t)
          	tmp = 0.0
          	if (Float64(x + y) <= -2e-208)
          		tmp = Float64(Float64(Float64(x - z) / t) * 0.5);
          	else
          		tmp = Float64(Float64(Float64(y - z) / t) * 0.5);
          	end
          	return tmp
          end
          
          x, y, z, t = num2cell(sort([x, y, z, t])){:}
          function tmp_2 = code(x, y, z, t)
          	tmp = 0.0;
          	if ((x + y) <= -2e-208)
          		tmp = ((x - z) / t) * 0.5;
          	else
          		tmp = ((y - z) / t) * 0.5;
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
          code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -2e-208], N[(N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision]]
          
          \begin{array}{l}
          [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;x + y \leq -2 \cdot 10^{-208}:\\
          \;\;\;\;\frac{x - z}{t} \cdot 0.5\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{y - z}{t} \cdot 0.5\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (+.f64 x y) < -2.0000000000000002e-208

            1. Initial program 99.2%

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

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{x - z}{t}} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \color{blue}{\frac{x - z}{t} \cdot \frac{1}{2}} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{x - z}{t} \cdot \frac{1}{2}} \]
              3. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{x - z}{t}} \cdot \frac{1}{2} \]
              4. lower--.f6462.9

                \[\leadsto \frac{\color{blue}{x - z}}{t} \cdot 0.5 \]
            5. Applied rewrites62.9%

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

            if -2.0000000000000002e-208 < (+.f64 x y)

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{y - z}{t}} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \color{blue}{\frac{y - z}{t} \cdot \frac{1}{2}} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{y - z}{t} \cdot \frac{1}{2}} \]
              3. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{y - z}{t}} \cdot \frac{1}{2} \]
              4. lower--.f6470.6

                \[\leadsto \frac{\color{blue}{y - z}}{t} \cdot 0.5 \]
            5. Applied rewrites70.6%

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

          Alternative 8: 87.4% accurate, 0.8× speedup?

          \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x + y \leq 4 \cdot 10^{+35}:\\ \;\;\;\;\frac{x - z}{t} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot 0.5}{t}\\ \end{array} \end{array} \]
          NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
          (FPCore (x y z t)
           :precision binary64
           (if (<= (+ x y) 4e+35) (* (/ (- x z) t) 0.5) (/ (* y 0.5) t)))
          assert(x < y && y < z && z < t);
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((x + y) <= 4e+35) {
          		tmp = ((x - z) / t) * 0.5;
          	} else {
          		tmp = (y * 0.5) / t;
          	}
          	return tmp;
          }
          
          NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
          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) <= 4d+35) then
                  tmp = ((x - z) / t) * 0.5d0
              else
                  tmp = (y * 0.5d0) / t
              end if
              code = tmp
          end function
          
          assert x < y && y < z && z < t;
          public static double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((x + y) <= 4e+35) {
          		tmp = ((x - z) / t) * 0.5;
          	} else {
          		tmp = (y * 0.5) / t;
          	}
          	return tmp;
          }
          
          [x, y, z, t] = sort([x, y, z, t])
          def code(x, y, z, t):
          	tmp = 0
          	if (x + y) <= 4e+35:
          		tmp = ((x - z) / t) * 0.5
          	else:
          		tmp = (y * 0.5) / t
          	return tmp
          
          x, y, z, t = sort([x, y, z, t])
          function code(x, y, z, t)
          	tmp = 0.0
          	if (Float64(x + y) <= 4e+35)
          		tmp = Float64(Float64(Float64(x - z) / t) * 0.5);
          	else
          		tmp = Float64(Float64(y * 0.5) / t);
          	end
          	return tmp
          end
          
          x, y, z, t = num2cell(sort([x, y, z, t])){:}
          function tmp_2 = code(x, y, z, t)
          	tmp = 0.0;
          	if ((x + y) <= 4e+35)
          		tmp = ((x - z) / t) * 0.5;
          	else
          		tmp = (y * 0.5) / t;
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
          code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 4e+35], N[(N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]
          
          \begin{array}{l}
          [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;x + y \leq 4 \cdot 10^{+35}:\\
          \;\;\;\;\frac{x - z}{t} \cdot 0.5\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{y \cdot 0.5}{t}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (+.f64 x y) < 3.9999999999999999e35

            1. Initial program 99.4%

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

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{x - z}{t}} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \color{blue}{\frac{x - z}{t} \cdot \frac{1}{2}} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{x - z}{t} \cdot \frac{1}{2}} \]
              3. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{x - z}{t}} \cdot \frac{1}{2} \]
              4. lower--.f6470.2

                \[\leadsto \frac{\color{blue}{x - z}}{t} \cdot 0.5 \]
            5. Applied rewrites70.2%

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

            if 3.9999999999999999e35 < (+.f64 x y)

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{y}{t}} \]
            4. Step-by-step derivation
              1. *-lft-identityN/A

                \[\leadsto \frac{1}{2} \cdot \frac{\color{blue}{1 \cdot y}}{t} \]
              2. associate-*l/N/A

                \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot y\right)} \]
              3. associate-*l*N/A

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot y} \]
              4. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot y} \]
              5. associate-*r/N/A

                \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot 1}{t}} \cdot y \]
              6. metadata-evalN/A

                \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{t} \cdot y \]
              7. lower-/.f6443.0

                \[\leadsto \color{blue}{\frac{0.5}{t}} \cdot y \]
            5. Applied rewrites43.0%

              \[\leadsto \color{blue}{\frac{0.5}{t} \cdot y} \]
            6. Step-by-step derivation
              1. Applied rewrites43.1%

                \[\leadsto \frac{y \cdot 0.5}{\color{blue}{t}} \]
            7. Recombined 2 regimes into one program.
            8. Add Preprocessing

            Alternative 9: 58.1% accurate, 0.9× speedup?

            \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x + y \leq -0.005:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.5}{t} \cdot z\\ \end{array} \end{array} \]
            NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
            (FPCore (x y z t)
             :precision binary64
             (if (<= (+ x y) -0.005) (* x (/ 0.5 t)) (* (/ -0.5 t) z)))
            assert(x < y && y < z && z < t);
            double code(double x, double y, double z, double t) {
            	double tmp;
            	if ((x + y) <= -0.005) {
            		tmp = x * (0.5 / t);
            	} else {
            		tmp = (-0.5 / t) * z;
            	}
            	return tmp;
            }
            
            NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
            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) <= (-0.005d0)) then
                    tmp = x * (0.5d0 / t)
                else
                    tmp = ((-0.5d0) / t) * z
                end if
                code = tmp
            end function
            
            assert x < y && y < z && z < t;
            public static double code(double x, double y, double z, double t) {
            	double tmp;
            	if ((x + y) <= -0.005) {
            		tmp = x * (0.5 / t);
            	} else {
            		tmp = (-0.5 / t) * z;
            	}
            	return tmp;
            }
            
            [x, y, z, t] = sort([x, y, z, t])
            def code(x, y, z, t):
            	tmp = 0
            	if (x + y) <= -0.005:
            		tmp = x * (0.5 / t)
            	else:
            		tmp = (-0.5 / t) * z
            	return tmp
            
            x, y, z, t = sort([x, y, z, t])
            function code(x, y, z, t)
            	tmp = 0.0
            	if (Float64(x + y) <= -0.005)
            		tmp = Float64(x * Float64(0.5 / t));
            	else
            		tmp = Float64(Float64(-0.5 / t) * z);
            	end
            	return tmp
            end
            
            x, y, z, t = num2cell(sort([x, y, z, t])){:}
            function tmp_2 = code(x, y, z, t)
            	tmp = 0.0;
            	if ((x + y) <= -0.005)
            		tmp = x * (0.5 / t);
            	else
            		tmp = (-0.5 / t) * z;
            	end
            	tmp_2 = tmp;
            end
            
            NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
            code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.005], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision]]
            
            \begin{array}{l}
            [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
            \\
            \begin{array}{l}
            \mathbf{if}\;x + y \leq -0.005:\\
            \;\;\;\;x \cdot \frac{0.5}{t}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{-0.5}{t} \cdot z\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (+.f64 x y) < -0.0050000000000000001

              1. Initial program 99.1%

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

                \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{x}{t}} \]
              4. Step-by-step derivation
                1. *-lft-identityN/A

                  \[\leadsto \frac{1}{2} \cdot \frac{\color{blue}{1 \cdot x}}{t} \]
                2. associate-*l/N/A

                  \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot x\right)} \]
                3. associate-*l*N/A

                  \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot x} \]
                4. lower-*.f64N/A

                  \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{t}\right) \cdot x} \]
                5. associate-*r/N/A

                  \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot 1}{t}} \cdot x \]
                6. metadata-evalN/A

                  \[\leadsto \frac{\color{blue}{\frac{1}{2}}}{t} \cdot x \]
                7. lower-/.f6435.4

                  \[\leadsto \color{blue}{\frac{0.5}{t}} \cdot x \]
              5. Applied rewrites35.4%

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

              if -0.0050000000000000001 < (+.f64 x y)

              1. Initial program 100.0%

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

                \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{t}} \]
              4. Step-by-step derivation
                1. *-lft-identityN/A

                  \[\leadsto \frac{-1}{2} \cdot \frac{\color{blue}{1 \cdot z}}{t} \]
                2. associate-*l/N/A

                  \[\leadsto \frac{-1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot z\right)} \]
                3. associate-*l*N/A

                  \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{1}{t}\right) \cdot z} \]
                4. metadata-evalN/A

                  \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot \frac{1}{t}\right) \cdot z \]
                5. distribute-lft-neg-inN/A

                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right)} \cdot z \]
                6. lower-*.f64N/A

                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right) \cdot z} \]
                7. associate-*r/N/A

                  \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{1}{2} \cdot 1}{t}}\right)\right) \cdot z \]
                8. metadata-evalN/A

                  \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{1}{2}}}{t}\right)\right) \cdot z \]
                9. distribute-neg-fracN/A

                  \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{t}} \cdot z \]
                10. metadata-evalN/A

                  \[\leadsto \frac{\color{blue}{\frac{-1}{2}}}{t} \cdot z \]
                11. lower-/.f6449.9

                  \[\leadsto \color{blue}{\frac{-0.5}{t}} \cdot z \]
              5. Applied rewrites49.9%

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

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

            Alternative 10: 99.7% accurate, 1.0× speedup?

            \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \left(\left(x + y\right) - z\right) \cdot \frac{0.5}{t} \end{array} \]
            NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
            (FPCore (x y z t) :precision binary64 (* (- (+ x y) z) (/ 0.5 t)))
            assert(x < y && y < z && z < t);
            double code(double x, double y, double z, double t) {
            	return ((x + y) - z) * (0.5 / t);
            }
            
            NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
            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) * (0.5d0 / t)
            end function
            
            assert x < y && y < z && z < t;
            public static double code(double x, double y, double z, double t) {
            	return ((x + y) - z) * (0.5 / t);
            }
            
            [x, y, z, t] = sort([x, y, z, t])
            def code(x, y, z, t):
            	return ((x + y) - z) * (0.5 / t)
            
            x, y, z, t = sort([x, y, z, t])
            function code(x, y, z, t)
            	return Float64(Float64(Float64(x + y) - z) * Float64(0.5 / t))
            end
            
            x, y, z, t = num2cell(sort([x, y, z, t])){:}
            function tmp = code(x, y, z, t)
            	tmp = ((x + y) - z) * (0.5 / t);
            end
            
            NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
            code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
            
            \begin{array}{l}
            [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
            \\
            \left(\left(x + y\right) - z\right) \cdot \frac{0.5}{t}
            \end{array}
            
            Derivation
            1. Initial program 99.6%

              \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{\left(x + y\right) - z}{t \cdot 2}} \]
              2. clear-numN/A

                \[\leadsto \color{blue}{\frac{1}{\frac{t \cdot 2}{\left(x + y\right) - z}}} \]
              3. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{1}{t \cdot 2} \cdot \left(\left(x + y\right) - z\right)} \]
              4. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{1}{t \cdot 2} \cdot \left(\left(x + y\right) - z\right)} \]
              5. lift-*.f64N/A

                \[\leadsto \frac{1}{\color{blue}{t \cdot 2}} \cdot \left(\left(x + y\right) - z\right) \]
              6. *-commutativeN/A

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

                \[\leadsto \color{blue}{\frac{\frac{1}{2}}{t}} \cdot \left(\left(x + y\right) - z\right) \]
              8. lower-/.f64N/A

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

                \[\leadsto \frac{\color{blue}{0.5}}{t} \cdot \left(\left(x + y\right) - z\right) \]
              10. lift-+.f64N/A

                \[\leadsto \frac{\frac{1}{2}}{t} \cdot \left(\color{blue}{\left(x + y\right)} - z\right) \]
              11. +-commutativeN/A

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

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

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

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

            Alternative 11: 38.6% accurate, 1.4× speedup?

            \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \frac{-0.5}{t} \cdot z \end{array} \]
            NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
            (FPCore (x y z t) :precision binary64 (* (/ -0.5 t) z))
            assert(x < y && y < z && z < t);
            double code(double x, double y, double z, double t) {
            	return (-0.5 / t) * z;
            }
            
            NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
            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
            end function
            
            assert x < y && y < z && z < t;
            public static double code(double x, double y, double z, double t) {
            	return (-0.5 / t) * z;
            }
            
            [x, y, z, t] = sort([x, y, z, t])
            def code(x, y, z, t):
            	return (-0.5 / t) * z
            
            x, y, z, t = sort([x, y, z, t])
            function code(x, y, z, t)
            	return Float64(Float64(-0.5 / t) * z)
            end
            
            x, y, z, t = num2cell(sort([x, y, z, t])){:}
            function tmp = code(x, y, z, t)
            	tmp = (-0.5 / t) * z;
            end
            
            NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
            code[x_, y_, z_, t_] := N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision]
            
            \begin{array}{l}
            [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
            \\
            \frac{-0.5}{t} \cdot z
            \end{array}
            
            Derivation
            1. Initial program 99.6%

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

              \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{t}} \]
            4. Step-by-step derivation
              1. *-lft-identityN/A

                \[\leadsto \frac{-1}{2} \cdot \frac{\color{blue}{1 \cdot z}}{t} \]
              2. associate-*l/N/A

                \[\leadsto \frac{-1}{2} \cdot \color{blue}{\left(\frac{1}{t} \cdot z\right)} \]
              3. associate-*l*N/A

                \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{1}{t}\right) \cdot z} \]
              4. metadata-evalN/A

                \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot \frac{1}{t}\right) \cdot z \]
              5. distribute-lft-neg-inN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right)} \cdot z \]
              6. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{t}\right)\right) \cdot z} \]
              7. associate-*r/N/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{1}{2} \cdot 1}{t}}\right)\right) \cdot z \]
              8. metadata-evalN/A

                \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{1}{2}}}{t}\right)\right) \cdot z \]
              9. distribute-neg-fracN/A

                \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{t}} \cdot z \]
              10. metadata-evalN/A

                \[\leadsto \frac{\color{blue}{\frac{-1}{2}}}{t} \cdot z \]
              11. lower-/.f6440.0

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

              \[\leadsto \color{blue}{\frac{-0.5}{t} \cdot z} \]
            6. Add Preprocessing

            Reproduce

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