Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, B

Percentage Accurate: 99.8% → 99.9%
Time: 6.8s
Alternatives: 9
Speedup: 1.2×

Specification

?
\[\begin{array}{l} \\ \frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (* 4.0 (- (- x y) (* z 0.5))) z))
double code(double x, double y, double z) {
	return (4.0 * ((x - y) - (z * 0.5))) / z;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (4.0d0 * ((x - y) - (z * 0.5d0))) / z
end function
public static double code(double x, double y, double z) {
	return (4.0 * ((x - y) - (z * 0.5))) / z;
}
def code(x, y, z):
	return (4.0 * ((x - y) - (z * 0.5))) / z
function code(x, y, z)
	return Float64(Float64(4.0 * Float64(Float64(x - y) - Float64(z * 0.5))) / z)
end
function tmp = code(x, y, z)
	tmp = (4.0 * ((x - y) - (z * 0.5))) / z;
end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - y), $MachinePrecision] - N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}

\\
\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (* 4.0 (- (- x y) (* z 0.5))) z))
double code(double x, double y, double z) {
	return (4.0 * ((x - y) - (z * 0.5))) / z;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (4.0d0 * ((x - y) - (z * 0.5d0))) / z
end function
public static double code(double x, double y, double z) {
	return (4.0 * ((x - y) - (z * 0.5))) / z;
}
def code(x, y, z):
	return (4.0 * ((x - y) - (z * 0.5))) / z
function code(x, y, z)
	return Float64(Float64(4.0 * Float64(Float64(x - y) - Float64(z * 0.5))) / z)
end
function tmp = code(x, y, z)
	tmp = (4.0 * ((x - y) - (z * 0.5))) / z;
end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - y), $MachinePrecision] - N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}

\\
\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
\end{array}

Alternative 1: 99.9% accurate, 1.2× speedup?

\[\begin{array}{l} \\ -2 + \frac{4 \cdot \left(x - y\right)}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (+ -2.0 (/ (* 4.0 (- x y)) z)))
double code(double x, double y, double z) {
	return -2.0 + ((4.0 * (x - y)) / z);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (-2.0d0) + ((4.0d0 * (x - y)) / z)
end function
public static double code(double x, double y, double z) {
	return -2.0 + ((4.0 * (x - y)) / z);
}
def code(x, y, z):
	return -2.0 + ((4.0 * (x - y)) / z)
function code(x, y, z)
	return Float64(-2.0 + Float64(Float64(4.0 * Float64(x - y)) / z))
end
function tmp = code(x, y, z)
	tmp = -2.0 + ((4.0 * (x - y)) / z);
end
code[x_, y_, z_] := N[(-2.0 + N[(N[(4.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
  2. Step-by-step derivation
    1. associate-*l/N/A

      \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
    2. sub-negN/A

      \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
    3. distribute-rgt-inN/A

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

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

      \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
    7. associate-*l/N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
    8. associate-/l*N/A

      \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
    9. distribute-neg-fracN/A

      \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
    10. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
    11. associate-/l*N/A

      \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
    12. distribute-lft-neg-inN/A

      \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
    14. *-inversesN/A

      \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
    16. metadata-evalN/A

      \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
    17. associate-*r/N/A

      \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
    18. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
    19. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
    20. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
    21. --lowering--.f6499.6%

      \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
  3. Simplified99.6%

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

Alternative 2: 52.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\frac{z}{4}}\\ \mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-251}:\\ \;\;\;\;-2\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{+81}:\\ \;\;\;\;-4 \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ x (/ z 4.0))))
   (if (<= x -3.2e-12)
     t_0
     (if (<= x 1.3e-251) -2.0 (if (<= x 1.2e+81) (* -4.0 (/ y z)) t_0)))))
double code(double x, double y, double z) {
	double t_0 = x / (z / 4.0);
	double tmp;
	if (x <= -3.2e-12) {
		tmp = t_0;
	} else if (x <= 1.3e-251) {
		tmp = -2.0;
	} else if (x <= 1.2e+81) {
		tmp = -4.0 * (y / z);
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x / (z / 4.0d0)
    if (x <= (-3.2d-12)) then
        tmp = t_0
    else if (x <= 1.3d-251) then
        tmp = -2.0d0
    else if (x <= 1.2d+81) then
        tmp = (-4.0d0) * (y / z)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x / (z / 4.0);
	double tmp;
	if (x <= -3.2e-12) {
		tmp = t_0;
	} else if (x <= 1.3e-251) {
		tmp = -2.0;
	} else if (x <= 1.2e+81) {
		tmp = -4.0 * (y / z);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x / (z / 4.0)
	tmp = 0
	if x <= -3.2e-12:
		tmp = t_0
	elif x <= 1.3e-251:
		tmp = -2.0
	elif x <= 1.2e+81:
		tmp = -4.0 * (y / z)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x / Float64(z / 4.0))
	tmp = 0.0
	if (x <= -3.2e-12)
		tmp = t_0;
	elseif (x <= 1.3e-251)
		tmp = -2.0;
	elseif (x <= 1.2e+81)
		tmp = Float64(-4.0 * Float64(y / z));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x / (z / 4.0);
	tmp = 0.0;
	if (x <= -3.2e-12)
		tmp = t_0;
	elseif (x <= 1.3e-251)
		tmp = -2.0;
	elseif (x <= 1.2e+81)
		tmp = -4.0 * (y / z);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x / N[(z / 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-12], t$95$0, If[LessEqual[x, 1.3e-251], -2.0, If[LessEqual[x, 1.2e+81], N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x}{\frac{z}{4}}\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.3 \cdot 10^{-251}:\\
\;\;\;\;-2\\

\mathbf{elif}\;x \leq 1.2 \cdot 10^{+81}:\\
\;\;\;\;-4 \cdot \frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.2000000000000001e-12 or 1.19999999999999995e81 < x

    1. Initial program 100.0%

      \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
    2. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
      2. sub-negN/A

        \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
      3. distribute-rgt-inN/A

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

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

        \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
      7. associate-*l/N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
      8. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
      9. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
      11. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
      12. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
      14. *-inversesN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
      17. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
      18. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
      19. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
      20. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
      21. --lowering--.f64100.0%

        \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
    3. Simplified100.0%

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

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

        \[\leadsto 4 \cdot \frac{1 \cdot x}{z} \]
      2. associate-*l/N/A

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

        \[\leadsto \left(4 \cdot \frac{1}{z}\right) \cdot \color{blue}{x} \]
      4. *-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(4 \cdot \frac{1}{z}\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(4 \cdot \frac{1}{z}\right)}\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{4 \cdot 1}{\color{blue}{z}}\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{4}{z}\right)\right) \]
      8. /-lowering-/.f6471.6%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(4, \color{blue}{z}\right)\right) \]
    7. Simplified71.6%

      \[\leadsto \color{blue}{x \cdot \frac{4}{z}} \]
    8. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto x \cdot \frac{1}{\color{blue}{\frac{z}{4}}} \]
      2. un-div-invN/A

        \[\leadsto \frac{x}{\color{blue}{\frac{z}{4}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{\left(\frac{z}{4}\right)}\right) \]
      4. /-lowering-/.f6471.9%

        \[\leadsto \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(z, \color{blue}{4}\right)\right) \]
    9. Applied egg-rr71.9%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{4}}} \]

    if -3.2000000000000001e-12 < x < 1.3e-251

    1. Initial program 100.0%

      \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
    2. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
      2. sub-negN/A

        \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
      3. distribute-rgt-inN/A

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

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

        \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
      7. associate-*l/N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
      8. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
      9. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
      11. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
      12. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
      14. *-inversesN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
      17. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
      18. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
      19. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
      20. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
      21. --lowering--.f64100.0%

        \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
    3. Simplified100.0%

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

      \[\leadsto \color{blue}{-2} \]
    6. Step-by-step derivation
      1. Simplified54.1%

        \[\leadsto \color{blue}{-2} \]

      if 1.3e-251 < x < 1.19999999999999995e81

      1. Initial program 98.6%

        \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
      2. Step-by-step derivation
        1. associate-*l/N/A

          \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
        2. sub-negN/A

          \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
        3. distribute-rgt-inN/A

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

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

          \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
        7. associate-*l/N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
        8. associate-/l*N/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
        9. distribute-neg-fracN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
        10. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
        11. associate-/l*N/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
        12. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
        13. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
        14. *-inversesN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
        16. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
        17. associate-*r/N/A

          \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
        18. /-lowering-/.f64N/A

          \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
        19. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
        20. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
        21. --lowering--.f6498.7%

          \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
      3. Simplified98.7%

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

        \[\leadsto \color{blue}{-4 \cdot \frac{y}{z}} \]
      6. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(-4, \color{blue}{\left(\frac{y}{z}\right)}\right) \]
        2. /-lowering-/.f6452.4%

          \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(y, \color{blue}{z}\right)\right) \]
      7. Simplified52.4%

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

    Alternative 3: 52.7% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{4}{\frac{z}{x}}\\ \mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-254}:\\ \;\;\;\;-2\\ \mathbf{elif}\;x \leq 4.1 \cdot 10^{+82}:\\ \;\;\;\;-4 \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (/ 4.0 (/ z x))))
       (if (<= x -3.2e-12)
         t_0
         (if (<= x 2.3e-254) -2.0 (if (<= x 4.1e+82) (* -4.0 (/ y z)) t_0)))))
    double code(double x, double y, double z) {
    	double t_0 = 4.0 / (z / x);
    	double tmp;
    	if (x <= -3.2e-12) {
    		tmp = t_0;
    	} else if (x <= 2.3e-254) {
    		tmp = -2.0;
    	} else if (x <= 4.1e+82) {
    		tmp = -4.0 * (y / z);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8) :: t_0
        real(8) :: tmp
        t_0 = 4.0d0 / (z / x)
        if (x <= (-3.2d-12)) then
            tmp = t_0
        else if (x <= 2.3d-254) then
            tmp = -2.0d0
        else if (x <= 4.1d+82) then
            tmp = (-4.0d0) * (y / z)
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double t_0 = 4.0 / (z / x);
    	double tmp;
    	if (x <= -3.2e-12) {
    		tmp = t_0;
    	} else if (x <= 2.3e-254) {
    		tmp = -2.0;
    	} else if (x <= 4.1e+82) {
    		tmp = -4.0 * (y / z);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = 4.0 / (z / x)
    	tmp = 0
    	if x <= -3.2e-12:
    		tmp = t_0
    	elif x <= 2.3e-254:
    		tmp = -2.0
    	elif x <= 4.1e+82:
    		tmp = -4.0 * (y / z)
    	else:
    		tmp = t_0
    	return tmp
    
    function code(x, y, z)
    	t_0 = Float64(4.0 / Float64(z / x))
    	tmp = 0.0
    	if (x <= -3.2e-12)
    		tmp = t_0;
    	elseif (x <= 2.3e-254)
    		tmp = -2.0;
    	elseif (x <= 4.1e+82)
    		tmp = Float64(-4.0 * Float64(y / z));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	t_0 = 4.0 / (z / x);
    	tmp = 0.0;
    	if (x <= -3.2e-12)
    		tmp = t_0;
    	elseif (x <= 2.3e-254)
    		tmp = -2.0;
    	elseif (x <= 4.1e+82)
    		tmp = -4.0 * (y / z);
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 / N[(z / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-12], t$95$0, If[LessEqual[x, 2.3e-254], -2.0, If[LessEqual[x, 4.1e+82], N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{4}{\frac{z}{x}}\\
    \mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 2.3 \cdot 10^{-254}:\\
    \;\;\;\;-2\\
    
    \mathbf{elif}\;x \leq 4.1 \cdot 10^{+82}:\\
    \;\;\;\;-4 \cdot \frac{y}{z}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if x < -3.2000000000000001e-12 or 4.09999999999999995e82 < x

      1. Initial program 100.0%

        \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
      2. Step-by-step derivation
        1. associate-*l/N/A

          \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
        2. sub-negN/A

          \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
        3. distribute-rgt-inN/A

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

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

          \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
        7. associate-*l/N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
        8. associate-/l*N/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
        9. distribute-neg-fracN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
        10. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
        11. associate-/l*N/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
        12. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
        13. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
        14. *-inversesN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
        16. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
        17. associate-*r/N/A

          \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
        18. /-lowering-/.f64N/A

          \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
        19. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
        20. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
        21. --lowering--.f64100.0%

          \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
      3. Simplified100.0%

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

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

          \[\leadsto 4 \cdot \frac{1 \cdot x}{z} \]
        2. associate-*l/N/A

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

          \[\leadsto \left(4 \cdot \frac{1}{z}\right) \cdot \color{blue}{x} \]
        4. *-commutativeN/A

          \[\leadsto x \cdot \color{blue}{\left(4 \cdot \frac{1}{z}\right)} \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(4 \cdot \frac{1}{z}\right)}\right) \]
        6. associate-*r/N/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{4 \cdot 1}{\color{blue}{z}}\right)\right) \]
        7. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{4}{z}\right)\right) \]
        8. /-lowering-/.f6471.6%

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(4, \color{blue}{z}\right)\right) \]
      7. Simplified71.6%

        \[\leadsto \color{blue}{x \cdot \frac{4}{z}} \]
      8. Step-by-step derivation
        1. clear-numN/A

          \[\leadsto x \cdot \frac{1}{\color{blue}{\frac{z}{4}}} \]
        2. un-div-invN/A

          \[\leadsto \frac{x}{\color{blue}{\frac{z}{4}}} \]
        3. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{\left(\frac{z}{4}\right)}\right) \]
        4. /-lowering-/.f6471.9%

          \[\leadsto \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(z, \color{blue}{4}\right)\right) \]
      9. Applied egg-rr71.9%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{4}}} \]
      10. Step-by-step derivation
        1. associate-/r/N/A

          \[\leadsto \frac{x}{z} \cdot \color{blue}{4} \]
        2. *-commutativeN/A

          \[\leadsto 4 \cdot \color{blue}{\frac{x}{z}} \]
        3. clear-numN/A

          \[\leadsto 4 \cdot \frac{1}{\color{blue}{\frac{z}{x}}} \]
        4. un-div-invN/A

          \[\leadsto \frac{4}{\color{blue}{\frac{z}{x}}} \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(4, \color{blue}{\left(\frac{z}{x}\right)}\right) \]
        6. /-lowering-/.f6471.7%

          \[\leadsto \mathsf{/.f64}\left(4, \mathsf{/.f64}\left(z, \color{blue}{x}\right)\right) \]
      11. Applied egg-rr71.7%

        \[\leadsto \color{blue}{\frac{4}{\frac{z}{x}}} \]

      if -3.2000000000000001e-12 < x < 2.2999999999999999e-254

      1. Initial program 100.0%

        \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
      2. Step-by-step derivation
        1. associate-*l/N/A

          \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
        2. sub-negN/A

          \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
        3. distribute-rgt-inN/A

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

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

          \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
        7. associate-*l/N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
        8. associate-/l*N/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
        9. distribute-neg-fracN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
        10. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
        11. associate-/l*N/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
        12. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
        13. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
        14. *-inversesN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
        16. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
        17. associate-*r/N/A

          \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
        18. /-lowering-/.f64N/A

          \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
        19. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
        20. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
        21. --lowering--.f64100.0%

          \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
      3. Simplified100.0%

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

        \[\leadsto \color{blue}{-2} \]
      6. Step-by-step derivation
        1. Simplified54.1%

          \[\leadsto \color{blue}{-2} \]

        if 2.2999999999999999e-254 < x < 4.09999999999999995e82

        1. Initial program 98.6%

          \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
        2. Step-by-step derivation
          1. associate-*l/N/A

            \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
          2. sub-negN/A

            \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
          3. distribute-rgt-inN/A

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

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

            \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
          7. associate-*l/N/A

            \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
          8. associate-/l*N/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
          9. distribute-neg-fracN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
          10. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
          11. associate-/l*N/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
          12. distribute-lft-neg-inN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
          13. metadata-evalN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
          14. *-inversesN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
          15. metadata-evalN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
          16. metadata-evalN/A

            \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
          17. associate-*r/N/A

            \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
          18. /-lowering-/.f64N/A

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
          19. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
          20. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
          21. --lowering--.f6498.7%

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
        3. Simplified98.7%

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

          \[\leadsto \color{blue}{-4 \cdot \frac{y}{z}} \]
        6. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(-4, \color{blue}{\left(\frac{y}{z}\right)}\right) \]
          2. /-lowering-/.f6452.4%

            \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(y, \color{blue}{z}\right)\right) \]
        7. Simplified52.4%

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

      Alternative 4: 52.8% accurate, 0.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{4}{z}\\ \mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{-255}:\\ \;\;\;\;-2\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+82}:\\ \;\;\;\;-4 \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (* x (/ 4.0 z))))
         (if (<= x -3.2e-12)
           t_0
           (if (<= x 7.5e-255) -2.0 (if (<= x 1.45e+82) (* -4.0 (/ y z)) t_0)))))
      double code(double x, double y, double z) {
      	double t_0 = x * (4.0 / z);
      	double tmp;
      	if (x <= -3.2e-12) {
      		tmp = t_0;
      	} else if (x <= 7.5e-255) {
      		tmp = -2.0;
      	} else if (x <= 1.45e+82) {
      		tmp = -4.0 * (y / z);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      real(8) function code(x, y, z)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8) :: t_0
          real(8) :: tmp
          t_0 = x * (4.0d0 / z)
          if (x <= (-3.2d-12)) then
              tmp = t_0
          else if (x <= 7.5d-255) then
              tmp = -2.0d0
          else if (x <= 1.45d+82) then
              tmp = (-4.0d0) * (y / z)
          else
              tmp = t_0
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double t_0 = x * (4.0 / z);
      	double tmp;
      	if (x <= -3.2e-12) {
      		tmp = t_0;
      	} else if (x <= 7.5e-255) {
      		tmp = -2.0;
      	} else if (x <= 1.45e+82) {
      		tmp = -4.0 * (y / z);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = x * (4.0 / z)
      	tmp = 0
      	if x <= -3.2e-12:
      		tmp = t_0
      	elif x <= 7.5e-255:
      		tmp = -2.0
      	elif x <= 1.45e+82:
      		tmp = -4.0 * (y / z)
      	else:
      		tmp = t_0
      	return tmp
      
      function code(x, y, z)
      	t_0 = Float64(x * Float64(4.0 / z))
      	tmp = 0.0
      	if (x <= -3.2e-12)
      		tmp = t_0;
      	elseif (x <= 7.5e-255)
      		tmp = -2.0;
      	elseif (x <= 1.45e+82)
      		tmp = Float64(-4.0 * Float64(y / z));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = x * (4.0 / z);
      	tmp = 0.0;
      	if (x <= -3.2e-12)
      		tmp = t_0;
      	elseif (x <= 7.5e-255)
      		tmp = -2.0;
      	elseif (x <= 1.45e+82)
      		tmp = -4.0 * (y / z);
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(4.0 / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-12], t$95$0, If[LessEqual[x, 7.5e-255], -2.0, If[LessEqual[x, 1.45e+82], N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := x \cdot \frac{4}{z}\\
      \mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 7.5 \cdot 10^{-255}:\\
      \;\;\;\;-2\\
      
      \mathbf{elif}\;x \leq 1.45 \cdot 10^{+82}:\\
      \;\;\;\;-4 \cdot \frac{y}{z}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if x < -3.2000000000000001e-12 or 1.4500000000000001e82 < x

        1. Initial program 100.0%

          \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
        2. Step-by-step derivation
          1. associate-*l/N/A

            \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
          2. sub-negN/A

            \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
          3. distribute-rgt-inN/A

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

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

            \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
          7. associate-*l/N/A

            \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
          8. associate-/l*N/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
          9. distribute-neg-fracN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
          10. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
          11. associate-/l*N/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
          12. distribute-lft-neg-inN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
          13. metadata-evalN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
          14. *-inversesN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
          15. metadata-evalN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
          16. metadata-evalN/A

            \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
          17. associate-*r/N/A

            \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
          18. /-lowering-/.f64N/A

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
          19. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
          20. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
          21. --lowering--.f64100.0%

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
        3. Simplified100.0%

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

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

            \[\leadsto 4 \cdot \frac{1 \cdot x}{z} \]
          2. associate-*l/N/A

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

            \[\leadsto \left(4 \cdot \frac{1}{z}\right) \cdot \color{blue}{x} \]
          4. *-commutativeN/A

            \[\leadsto x \cdot \color{blue}{\left(4 \cdot \frac{1}{z}\right)} \]
          5. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(4 \cdot \frac{1}{z}\right)}\right) \]
          6. associate-*r/N/A

            \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{4 \cdot 1}{\color{blue}{z}}\right)\right) \]
          7. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{4}{z}\right)\right) \]
          8. /-lowering-/.f6471.6%

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(4, \color{blue}{z}\right)\right) \]
        7. Simplified71.6%

          \[\leadsto \color{blue}{x \cdot \frac{4}{z}} \]

        if -3.2000000000000001e-12 < x < 7.50000000000000029e-255

        1. Initial program 100.0%

          \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
        2. Step-by-step derivation
          1. associate-*l/N/A

            \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
          2. sub-negN/A

            \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
          3. distribute-rgt-inN/A

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

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

            \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
          7. associate-*l/N/A

            \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
          8. associate-/l*N/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
          9. distribute-neg-fracN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
          10. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
          11. associate-/l*N/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
          12. distribute-lft-neg-inN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
          13. metadata-evalN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
          14. *-inversesN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
          15. metadata-evalN/A

            \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
          16. metadata-evalN/A

            \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
          17. associate-*r/N/A

            \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
          18. /-lowering-/.f64N/A

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
          19. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
          20. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
          21. --lowering--.f64100.0%

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
        3. Simplified100.0%

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

          \[\leadsto \color{blue}{-2} \]
        6. Step-by-step derivation
          1. Simplified54.1%

            \[\leadsto \color{blue}{-2} \]

          if 7.50000000000000029e-255 < x < 1.4500000000000001e82

          1. Initial program 98.6%

            \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
          2. Step-by-step derivation
            1. associate-*l/N/A

              \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
            2. sub-negN/A

              \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
            3. distribute-rgt-inN/A

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

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

              \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
            6. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
            7. associate-*l/N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            8. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            9. distribute-neg-fracN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            10. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            11. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            12. distribute-lft-neg-inN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            13. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            14. *-inversesN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            15. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            16. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            17. associate-*r/N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
            18. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
            19. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
            20. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
            21. --lowering--.f6498.7%

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
          3. Simplified98.7%

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

            \[\leadsto \color{blue}{-4 \cdot \frac{y}{z}} \]
          6. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(-4, \color{blue}{\left(\frac{y}{z}\right)}\right) \]
            2. /-lowering-/.f6452.4%

              \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(y, \color{blue}{z}\right)\right) \]
          7. Simplified52.4%

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

        Alternative 5: 85.5% accurate, 0.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{-61}:\\ \;\;\;\;4 \cdot \frac{x - y}{z}\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-8}:\\ \;\;\;\;-2 + x \cdot \frac{4}{z}\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{y \cdot -4}{z}\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y -1.3e-61)
           (* 4.0 (/ (- x y) z))
           (if (<= y 2.3e-8) (+ -2.0 (* x (/ 4.0 z))) (+ -2.0 (/ (* y -4.0) z)))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -1.3e-61) {
        		tmp = 4.0 * ((x - y) / z);
        	} else if (y <= 2.3e-8) {
        		tmp = -2.0 + (x * (4.0 / z));
        	} else {
        		tmp = -2.0 + ((y * -4.0) / z);
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if (y <= (-1.3d-61)) then
                tmp = 4.0d0 * ((x - y) / z)
            else if (y <= 2.3d-8) then
                tmp = (-2.0d0) + (x * (4.0d0 / z))
            else
                tmp = (-2.0d0) + ((y * (-4.0d0)) / z)
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -1.3e-61) {
        		tmp = 4.0 * ((x - y) / z);
        	} else if (y <= 2.3e-8) {
        		tmp = -2.0 + (x * (4.0 / z));
        	} else {
        		tmp = -2.0 + ((y * -4.0) / z);
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= -1.3e-61:
        		tmp = 4.0 * ((x - y) / z)
        	elif y <= 2.3e-8:
        		tmp = -2.0 + (x * (4.0 / z))
        	else:
        		tmp = -2.0 + ((y * -4.0) / z)
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -1.3e-61)
        		tmp = Float64(4.0 * Float64(Float64(x - y) / z));
        	elseif (y <= 2.3e-8)
        		tmp = Float64(-2.0 + Float64(x * Float64(4.0 / z)));
        	else
        		tmp = Float64(-2.0 + Float64(Float64(y * -4.0) / z));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (y <= -1.3e-61)
        		tmp = 4.0 * ((x - y) / z);
        	elseif (y <= 2.3e-8)
        		tmp = -2.0 + (x * (4.0 / z));
        	else
        		tmp = -2.0 + ((y * -4.0) / z);
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -1.3e-61], N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e-8], N[(-2.0 + N[(x * N[(4.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(y * -4.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -1.3 \cdot 10^{-61}:\\
        \;\;\;\;4 \cdot \frac{x - y}{z}\\
        
        \mathbf{elif}\;y \leq 2.3 \cdot 10^{-8}:\\
        \;\;\;\;-2 + x \cdot \frac{4}{z}\\
        
        \mathbf{else}:\\
        \;\;\;\;-2 + \frac{y \cdot -4}{z}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y < -1.30000000000000005e-61

          1. Initial program 100.0%

            \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
          2. Step-by-step derivation
            1. associate-*l/N/A

              \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
            2. sub-negN/A

              \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
            3. distribute-rgt-inN/A

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

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

              \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
            6. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
            7. associate-*l/N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            8. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            9. distribute-neg-fracN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            10. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            11. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            12. distribute-lft-neg-inN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            13. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            14. *-inversesN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            15. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            16. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            17. associate-*r/N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
            18. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
            19. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
            20. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
            21. --lowering--.f64100.0%

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
          3. Simplified100.0%

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

            \[\leadsto \color{blue}{4 \cdot \frac{x - y}{z}} \]
          6. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{\left(\frac{x - y}{z}\right)}\right) \]
            2. /-lowering-/.f64N/A

              \[\leadsto \mathsf{*.f64}\left(4, \mathsf{/.f64}\left(\left(x - y\right), \color{blue}{z}\right)\right) \]
            3. --lowering--.f6484.8%

              \[\leadsto \mathsf{*.f64}\left(4, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x, y\right), z\right)\right) \]
          7. Simplified84.8%

            \[\leadsto \color{blue}{4 \cdot \frac{x - y}{z}} \]

          if -1.30000000000000005e-61 < y < 2.3000000000000001e-8

          1. Initial program 100.0%

            \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
          2. Step-by-step derivation
            1. associate-*l/N/A

              \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
            2. sub-negN/A

              \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
            3. distribute-rgt-inN/A

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

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

              \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
            6. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
            7. associate-*l/N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            8. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            9. distribute-neg-fracN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            10. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            11. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            12. distribute-lft-neg-inN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            13. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            14. *-inversesN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            15. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            16. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            17. associate-*r/N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
            18. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
            19. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
            20. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
            21. --lowering--.f64100.0%

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
          3. Simplified100.0%

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

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

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

              \[\leadsto 4 \cdot \frac{x}{z} + -2 \]
            3. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{x}{z}\right), \color{blue}{-2}\right) \]
            4. *-lft-identityN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{1 \cdot x}{z}\right), -2\right) \]
            5. associate-*l/N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{1}{z} \cdot x\right)\right), -2\right) \]
            6. associate-*l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\left(4 \cdot \frac{1}{z}\right) \cdot x\right), -2\right) \]
            7. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \left(4 \cdot \frac{1}{z}\right)\right), -2\right) \]
            8. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \left(4 \cdot \frac{1}{z}\right)\right), -2\right) \]
            9. associate-*r/N/A

              \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \left(\frac{4 \cdot 1}{z}\right)\right), -2\right) \]
            10. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \left(\frac{4}{z}\right)\right), -2\right) \]
            11. /-lowering-/.f6495.4%

              \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(4, z\right)\right), -2\right) \]
          7. Simplified95.4%

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

          if 2.3000000000000001e-8 < y

          1. Initial program 98.6%

            \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
          2. Step-by-step derivation
            1. associate-*l/N/A

              \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
            2. sub-negN/A

              \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
            3. distribute-rgt-inN/A

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

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

              \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
            6. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
            7. associate-*l/N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            8. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            9. distribute-neg-fracN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            10. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            11. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            12. distribute-lft-neg-inN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            13. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            14. *-inversesN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            15. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            16. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            17. associate-*r/N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
            18. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
            19. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
            20. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
            21. --lowering--.f6498.6%

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
          3. Simplified98.6%

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

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\color{blue}{\left(-4 \cdot y\right)}, z\right)\right) \]
          6. Step-by-step derivation
            1. *-lowering-*.f6483.1%

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(-4, y\right), z\right)\right) \]
          7. Simplified83.1%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{-61}:\\ \;\;\;\;4 \cdot \frac{x - y}{z}\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-8}:\\ \;\;\;\;-2 + x \cdot \frac{4}{z}\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{y \cdot -4}{z}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 6: 84.6% accurate, 0.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := 4 \cdot \frac{x - y}{z}\\ \mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{+111}:\\ \;\;\;\;-2 + \frac{y \cdot -4}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (let* ((t_0 (* 4.0 (/ (- x y) z))))
           (if (<= x -3.2e-12)
             t_0
             (if (<= x 4.4e+111) (+ -2.0 (/ (* y -4.0) z)) t_0))))
        double code(double x, double y, double z) {
        	double t_0 = 4.0 * ((x - y) / z);
        	double tmp;
        	if (x <= -3.2e-12) {
        		tmp = t_0;
        	} else if (x <= 4.4e+111) {
        		tmp = -2.0 + ((y * -4.0) / z);
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: t_0
            real(8) :: tmp
            t_0 = 4.0d0 * ((x - y) / z)
            if (x <= (-3.2d-12)) then
                tmp = t_0
            else if (x <= 4.4d+111) then
                tmp = (-2.0d0) + ((y * (-4.0d0)) / z)
            else
                tmp = t_0
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double t_0 = 4.0 * ((x - y) / z);
        	double tmp;
        	if (x <= -3.2e-12) {
        		tmp = t_0;
        	} else if (x <= 4.4e+111) {
        		tmp = -2.0 + ((y * -4.0) / z);
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	t_0 = 4.0 * ((x - y) / z)
        	tmp = 0
        	if x <= -3.2e-12:
        		tmp = t_0
        	elif x <= 4.4e+111:
        		tmp = -2.0 + ((y * -4.0) / z)
        	else:
        		tmp = t_0
        	return tmp
        
        function code(x, y, z)
        	t_0 = Float64(4.0 * Float64(Float64(x - y) / z))
        	tmp = 0.0
        	if (x <= -3.2e-12)
        		tmp = t_0;
        	elseif (x <= 4.4e+111)
        		tmp = Float64(-2.0 + Float64(Float64(y * -4.0) / z));
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	t_0 = 4.0 * ((x - y) / z);
        	tmp = 0.0;
        	if (x <= -3.2e-12)
        		tmp = t_0;
        	elseif (x <= 4.4e+111)
        		tmp = -2.0 + ((y * -4.0) / z);
        	else
        		tmp = t_0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-12], t$95$0, If[LessEqual[x, 4.4e+111], N[(-2.0 + N[(N[(y * -4.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := 4 \cdot \frac{x - y}{z}\\
        \mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;x \leq 4.4 \cdot 10^{+111}:\\
        \;\;\;\;-2 + \frac{y \cdot -4}{z}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < -3.2000000000000001e-12 or 4.39999999999999997e111 < x

          1. Initial program 100.0%

            \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
          2. Step-by-step derivation
            1. associate-*l/N/A

              \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
            2. sub-negN/A

              \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
            3. distribute-rgt-inN/A

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

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

              \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
            6. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
            7. associate-*l/N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            8. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            9. distribute-neg-fracN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            10. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            11. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            12. distribute-lft-neg-inN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            13. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            14. *-inversesN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            15. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            16. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            17. associate-*r/N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
            18. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
            19. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
            20. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
            21. --lowering--.f64100.0%

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
          3. Simplified100.0%

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

            \[\leadsto \color{blue}{4 \cdot \frac{x - y}{z}} \]
          6. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{\left(\frac{x - y}{z}\right)}\right) \]
            2. /-lowering-/.f64N/A

              \[\leadsto \mathsf{*.f64}\left(4, \mathsf{/.f64}\left(\left(x - y\right), \color{blue}{z}\right)\right) \]
            3. --lowering--.f6490.0%

              \[\leadsto \mathsf{*.f64}\left(4, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x, y\right), z\right)\right) \]
          7. Simplified90.0%

            \[\leadsto \color{blue}{4 \cdot \frac{x - y}{z}} \]

          if -3.2000000000000001e-12 < x < 4.39999999999999997e111

          1. Initial program 99.3%

            \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
          2. Step-by-step derivation
            1. associate-*l/N/A

              \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
            2. sub-negN/A

              \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
            3. distribute-rgt-inN/A

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

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

              \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
            6. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
            7. associate-*l/N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            8. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            9. distribute-neg-fracN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            10. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            11. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            12. distribute-lft-neg-inN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            13. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            14. *-inversesN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            15. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            16. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            17. associate-*r/N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
            18. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
            19. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
            20. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
            21. --lowering--.f6499.3%

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
          3. Simplified99.3%

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

            \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\color{blue}{\left(-4 \cdot y\right)}, z\right)\right) \]
          6. Step-by-step derivation
            1. *-lowering-*.f6488.0%

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(-4, y\right), z\right)\right) \]
          7. Simplified88.0%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.2 \cdot 10^{-12}:\\ \;\;\;\;4 \cdot \frac{x - y}{z}\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{+111}:\\ \;\;\;\;-2 + \frac{y \cdot -4}{z}\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \frac{x - y}{z}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 7: 79.0% accurate, 0.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{+170}:\\ \;\;\;\;-2\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+129}:\\ \;\;\;\;4 \cdot \frac{x - y}{z}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= z -1.3e+170) -2.0 (if (<= z 9.5e+129) (* 4.0 (/ (- x y) z)) -2.0)))
        double code(double x, double y, double z) {
        	double tmp;
        	if (z <= -1.3e+170) {
        		tmp = -2.0;
        	} else if (z <= 9.5e+129) {
        		tmp = 4.0 * ((x - y) / z);
        	} else {
        		tmp = -2.0;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if (z <= (-1.3d+170)) then
                tmp = -2.0d0
            else if (z <= 9.5d+129) then
                tmp = 4.0d0 * ((x - y) / z)
            else
                tmp = -2.0d0
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (z <= -1.3e+170) {
        		tmp = -2.0;
        	} else if (z <= 9.5e+129) {
        		tmp = 4.0 * ((x - y) / z);
        	} else {
        		tmp = -2.0;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if z <= -1.3e+170:
        		tmp = -2.0
        	elif z <= 9.5e+129:
        		tmp = 4.0 * ((x - y) / z)
        	else:
        		tmp = -2.0
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (z <= -1.3e+170)
        		tmp = -2.0;
        	elseif (z <= 9.5e+129)
        		tmp = Float64(4.0 * Float64(Float64(x - y) / z));
        	else
        		tmp = -2.0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (z <= -1.3e+170)
        		tmp = -2.0;
        	elseif (z <= 9.5e+129)
        		tmp = 4.0 * ((x - y) / z);
        	else
        		tmp = -2.0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[z, -1.3e+170], -2.0, If[LessEqual[z, 9.5e+129], N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], -2.0]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -1.3 \cdot 10^{+170}:\\
        \;\;\;\;-2\\
        
        \mathbf{elif}\;z \leq 9.5 \cdot 10^{+129}:\\
        \;\;\;\;4 \cdot \frac{x - y}{z}\\
        
        \mathbf{else}:\\
        \;\;\;\;-2\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -1.2999999999999999e170 or 9.5000000000000004e129 < z

          1. Initial program 98.4%

            \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
          2. Step-by-step derivation
            1. associate-*l/N/A

              \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
            2. sub-negN/A

              \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
            3. distribute-rgt-inN/A

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

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

              \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
            6. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
            7. associate-*l/N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            8. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            9. distribute-neg-fracN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            10. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            11. associate-/l*N/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            12. distribute-lft-neg-inN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            13. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            14. *-inversesN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
            15. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
            16. metadata-evalN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
            17. associate-*r/N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
            18. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
            19. *-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
            20. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
            21. --lowering--.f6498.4%

              \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
          3. Simplified98.4%

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

            \[\leadsto \color{blue}{-2} \]
          6. Step-by-step derivation
            1. Simplified75.0%

              \[\leadsto \color{blue}{-2} \]

            if -1.2999999999999999e170 < z < 9.5000000000000004e129

            1. Initial program 100.0%

              \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
            2. Step-by-step derivation
              1. associate-*l/N/A

                \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
              2. sub-negN/A

                \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
              3. distribute-rgt-inN/A

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

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

                \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
              6. +-lowering-+.f64N/A

                \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
              7. associate-*l/N/A

                \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
              8. associate-/l*N/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
              9. distribute-neg-fracN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
              10. *-commutativeN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              11. associate-/l*N/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              12. distribute-lft-neg-inN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
              13. metadata-evalN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              14. *-inversesN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              15. metadata-evalN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
              16. metadata-evalN/A

                \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
              17. associate-*r/N/A

                \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
              18. /-lowering-/.f64N/A

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
              19. *-commutativeN/A

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
              20. *-lowering-*.f64N/A

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
              21. --lowering--.f64100.0%

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
            3. Simplified100.0%

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

              \[\leadsto \color{blue}{4 \cdot \frac{x - y}{z}} \]
            6. Step-by-step derivation
              1. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{\left(\frac{x - y}{z}\right)}\right) \]
              2. /-lowering-/.f64N/A

                \[\leadsto \mathsf{*.f64}\left(4, \mathsf{/.f64}\left(\left(x - y\right), \color{blue}{z}\right)\right) \]
              3. --lowering--.f6483.5%

                \[\leadsto \mathsf{*.f64}\left(4, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x, y\right), z\right)\right) \]
            7. Simplified83.5%

              \[\leadsto \color{blue}{4 \cdot \frac{x - y}{z}} \]
          7. Recombined 2 regimes into one program.
          8. Add Preprocessing

          Alternative 8: 53.3% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := -4 \cdot \frac{y}{z}\\ \mathbf{if}\;y \leq -5.5 \cdot 10^{+50}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-24}:\\ \;\;\;\;-2\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (* -4.0 (/ y z))))
             (if (<= y -5.5e+50) t_0 (if (<= y 4.2e-24) -2.0 t_0))))
          double code(double x, double y, double z) {
          	double t_0 = -4.0 * (y / z);
          	double tmp;
          	if (y <= -5.5e+50) {
          		tmp = t_0;
          	} else if (y <= 4.2e-24) {
          		tmp = -2.0;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          real(8) function code(x, y, z)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8) :: t_0
              real(8) :: tmp
              t_0 = (-4.0d0) * (y / z)
              if (y <= (-5.5d+50)) then
                  tmp = t_0
              else if (y <= 4.2d-24) then
                  tmp = -2.0d0
              else
                  tmp = t_0
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z) {
          	double t_0 = -4.0 * (y / z);
          	double tmp;
          	if (y <= -5.5e+50) {
          		tmp = t_0;
          	} else if (y <= 4.2e-24) {
          		tmp = -2.0;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	t_0 = -4.0 * (y / z)
          	tmp = 0
          	if y <= -5.5e+50:
          		tmp = t_0
          	elif y <= 4.2e-24:
          		tmp = -2.0
          	else:
          		tmp = t_0
          	return tmp
          
          function code(x, y, z)
          	t_0 = Float64(-4.0 * Float64(y / z))
          	tmp = 0.0
          	if (y <= -5.5e+50)
          		tmp = t_0;
          	elseif (y <= 4.2e-24)
          		tmp = -2.0;
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	t_0 = -4.0 * (y / z);
          	tmp = 0.0;
          	if (y <= -5.5e+50)
          		tmp = t_0;
          	elseif (y <= 4.2e-24)
          		tmp = -2.0;
          	else
          		tmp = t_0;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.5e+50], t$95$0, If[LessEqual[y, 4.2e-24], -2.0, t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := -4 \cdot \frac{y}{z}\\
          \mathbf{if}\;y \leq -5.5 \cdot 10^{+50}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;y \leq 4.2 \cdot 10^{-24}:\\
          \;\;\;\;-2\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < -5.4999999999999998e50 or 4.1999999999999999e-24 < y

            1. Initial program 99.2%

              \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
            2. Step-by-step derivation
              1. associate-*l/N/A

                \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
              2. sub-negN/A

                \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
              3. distribute-rgt-inN/A

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

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

                \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
              6. +-lowering-+.f64N/A

                \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
              7. associate-*l/N/A

                \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
              8. associate-/l*N/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
              9. distribute-neg-fracN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
              10. *-commutativeN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              11. associate-/l*N/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              12. distribute-lft-neg-inN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
              13. metadata-evalN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              14. *-inversesN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              15. metadata-evalN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
              16. metadata-evalN/A

                \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
              17. associate-*r/N/A

                \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
              18. /-lowering-/.f64N/A

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
              19. *-commutativeN/A

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
              20. *-lowering-*.f64N/A

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
              21. --lowering--.f6499.2%

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
            3. Simplified99.2%

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

              \[\leadsto \color{blue}{-4 \cdot \frac{y}{z}} \]
            6. Step-by-step derivation
              1. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(-4, \color{blue}{\left(\frac{y}{z}\right)}\right) \]
              2. /-lowering-/.f6465.2%

                \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(y, \color{blue}{z}\right)\right) \]
            7. Simplified65.2%

              \[\leadsto \color{blue}{-4 \cdot \frac{y}{z}} \]

            if -5.4999999999999998e50 < y < 4.1999999999999999e-24

            1. Initial program 100.0%

              \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
            2. Step-by-step derivation
              1. associate-*l/N/A

                \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
              2. sub-negN/A

                \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
              3. distribute-rgt-inN/A

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

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

                \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
              6. +-lowering-+.f64N/A

                \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
              7. associate-*l/N/A

                \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
              8. associate-/l*N/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
              9. distribute-neg-fracN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
              10. *-commutativeN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              11. associate-/l*N/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              12. distribute-lft-neg-inN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
              13. metadata-evalN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              14. *-inversesN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              15. metadata-evalN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
              16. metadata-evalN/A

                \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
              17. associate-*r/N/A

                \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
              18. /-lowering-/.f64N/A

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
              19. *-commutativeN/A

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
              20. *-lowering-*.f64N/A

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
              21. --lowering--.f64100.0%

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
            3. Simplified100.0%

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

              \[\leadsto \color{blue}{-2} \]
            6. Step-by-step derivation
              1. Simplified43.5%

                \[\leadsto \color{blue}{-2} \]
            7. Recombined 2 regimes into one program.
            8. Add Preprocessing

            Alternative 9: 34.7% accurate, 11.0× speedup?

            \[\begin{array}{l} \\ -2 \end{array} \]
            (FPCore (x y z) :precision binary64 -2.0)
            double code(double x, double y, double z) {
            	return -2.0;
            }
            
            real(8) function code(x, y, z)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                code = -2.0d0
            end function
            
            public static double code(double x, double y, double z) {
            	return -2.0;
            }
            
            def code(x, y, z):
            	return -2.0
            
            function code(x, y, z)
            	return -2.0
            end
            
            function tmp = code(x, y, z)
            	tmp = -2.0;
            end
            
            code[x_, y_, z_] := -2.0
            
            \begin{array}{l}
            
            \\
            -2
            \end{array}
            
            Derivation
            1. Initial program 99.6%

              \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z} \]
            2. Step-by-step derivation
              1. associate-*l/N/A

                \[\leadsto \frac{4}{z} \cdot \color{blue}{\left(\left(x - y\right) - z \cdot \frac{1}{2}\right)} \]
              2. sub-negN/A

                \[\leadsto \frac{4}{z} \cdot \left(\left(x - y\right) + \color{blue}{\left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}\right) \]
              3. distribute-rgt-inN/A

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

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

                \[\leadsto \frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right) + \color{blue}{\left(x - y\right) \cdot \frac{4}{z}} \]
              6. +-lowering-+.f64N/A

                \[\leadsto \mathsf{+.f64}\left(\left(\frac{4}{z} \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)\right), \color{blue}{\left(\left(x - y\right) \cdot \frac{4}{z}\right)}\right) \]
              7. associate-*l/N/A

                \[\leadsto \mathsf{+.f64}\left(\left(\frac{4 \cdot \left(\mathsf{neg}\left(z \cdot \frac{1}{2}\right)\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
              8. associate-/l*N/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{\mathsf{neg}\left(z \cdot \frac{1}{2}\right)}{z}\right), \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
              9. distribute-neg-fracN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{z \cdot \frac{1}{2}}{z}\right)\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
              10. *-commutativeN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              11. associate-/l*N/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{z}{z}\right)\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              12. distribute-lft-neg-inN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{z}{z}\right)\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
              13. metadata-evalN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot \frac{z}{z}\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              14. *-inversesN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \left(\frac{-1}{2} \cdot 1\right)\right), \left(\left(x - y\right) \cdot \frac{4}{z}\right)\right) \]
              15. metadata-evalN/A

                \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot \frac{-1}{2}\right), \left(\left(x - \color{blue}{y}\right) \cdot \frac{4}{z}\right)\right) \]
              16. metadata-evalN/A

                \[\leadsto \mathsf{+.f64}\left(-2, \left(\color{blue}{\left(x - y\right)} \cdot \frac{4}{z}\right)\right) \]
              17. associate-*r/N/A

                \[\leadsto \mathsf{+.f64}\left(-2, \left(\frac{\left(x - y\right) \cdot 4}{\color{blue}{z}}\right)\right) \]
              18. /-lowering-/.f64N/A

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(\left(x - y\right) \cdot 4\right), \color{blue}{z}\right)\right) \]
              19. *-commutativeN/A

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\left(4 \cdot \left(x - y\right)\right), z\right)\right) \]
              20. *-lowering-*.f64N/A

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - y\right)\right), z\right)\right) \]
              21. --lowering--.f6499.6%

                \[\leadsto \mathsf{+.f64}\left(-2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, y\right)\right), z\right)\right) \]
            3. Simplified99.6%

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

              \[\leadsto \color{blue}{-2} \]
            6. Step-by-step derivation
              1. Simplified31.0%

                \[\leadsto \color{blue}{-2} \]
              2. Add Preprocessing

              Developer Target 1: 98.1% accurate, 0.8× speedup?

              \[\begin{array}{l} \\ 4 \cdot \frac{x}{z} - \left(2 + 4 \cdot \frac{y}{z}\right) \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (- (* 4.0 (/ x z)) (+ 2.0 (* 4.0 (/ y z)))))
              double code(double x, double y, double z) {
              	return (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)));
              }
              
              real(8) function code(x, y, z)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8), intent (in) :: z
                  code = (4.0d0 * (x / z)) - (2.0d0 + (4.0d0 * (y / z)))
              end function
              
              public static double code(double x, double y, double z) {
              	return (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)));
              }
              
              def code(x, y, z):
              	return (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)))
              
              function code(x, y, z)
              	return Float64(Float64(4.0 * Float64(x / z)) - Float64(2.0 + Float64(4.0 * Float64(y / z))))
              end
              
              function tmp = code(x, y, z)
              	tmp = (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)));
              end
              
              code[x_, y_, z_] := N[(N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(2.0 + N[(4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              4 \cdot \frac{x}{z} - \left(2 + 4 \cdot \frac{y}{z}\right)
              \end{array}
              

              Reproduce

              ?
              herbie shell --seed 2024138 
              (FPCore (x y z)
                :name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, B"
                :precision binary64
              
                :alt
                (! :herbie-platform default (- (* 4 (/ x z)) (+ 2 (* 4 (/ y z)))))
              
                (/ (* 4.0 (- (- x y) (* z 0.5))) z))