Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1

Percentage Accurate: 88.7% → 99.8%
Time: 8.5s
Alternatives: 11
Speedup: 1.0×

Specification

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

\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 88.7% accurate, 1.0× speedup?

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

\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}

Alternative 1: 99.8% accurate, 1.0× speedup?

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

\\
x \cdot \frac{\frac{x}{y} + 1}{x + 1}
\end{array}
Derivation
  1. Initial program 87.5%

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

      \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
    2. *-lowering-*.f64N/A

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 2: 86.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y}{y}\\ t_1 := \frac{x}{x + 1}\\ \mathbf{if}\;x \leq -6300000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.95 \cdot 10^{-95}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 2 \cdot 10^{-48}:\\ \;\;\;\;\frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq 1400:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (+ x y) y)) (t_1 (/ x (+ x 1.0))))
   (if (<= x -6300000.0)
     t_0
     (if (<= x 2.95e-95)
       t_1
       (if (<= x 2e-48) (/ x (/ y x)) (if (<= x 1400.0) t_1 t_0))))))
double code(double x, double y) {
	double t_0 = (x + y) / y;
	double t_1 = x / (x + 1.0);
	double tmp;
	if (x <= -6300000.0) {
		tmp = t_0;
	} else if (x <= 2.95e-95) {
		tmp = t_1;
	} else if (x <= 2e-48) {
		tmp = x / (y / x);
	} else if (x <= 1400.0) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (x + y) / y
    t_1 = x / (x + 1.0d0)
    if (x <= (-6300000.0d0)) then
        tmp = t_0
    else if (x <= 2.95d-95) then
        tmp = t_1
    else if (x <= 2d-48) then
        tmp = x / (y / x)
    else if (x <= 1400.0d0) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (x + y) / y;
	double t_1 = x / (x + 1.0);
	double tmp;
	if (x <= -6300000.0) {
		tmp = t_0;
	} else if (x <= 2.95e-95) {
		tmp = t_1;
	} else if (x <= 2e-48) {
		tmp = x / (y / x);
	} else if (x <= 1400.0) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = (x + y) / y
	t_1 = x / (x + 1.0)
	tmp = 0
	if x <= -6300000.0:
		tmp = t_0
	elif x <= 2.95e-95:
		tmp = t_1
	elif x <= 2e-48:
		tmp = x / (y / x)
	elif x <= 1400.0:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(Float64(x + y) / y)
	t_1 = Float64(x / Float64(x + 1.0))
	tmp = 0.0
	if (x <= -6300000.0)
		tmp = t_0;
	elseif (x <= 2.95e-95)
		tmp = t_1;
	elseif (x <= 2e-48)
		tmp = Float64(x / Float64(y / x));
	elseif (x <= 1400.0)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (x + y) / y;
	t_1 = x / (x + 1.0);
	tmp = 0.0;
	if (x <= -6300000.0)
		tmp = t_0;
	elseif (x <= 2.95e-95)
		tmp = t_1;
	elseif (x <= 2e-48)
		tmp = x / (y / x);
	elseif (x <= 1400.0)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6300000.0], t$95$0, If[LessEqual[x, 2.95e-95], t$95$1, If[LessEqual[x, 2e-48], N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1400.0], t$95$1, t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x + y}{y}\\
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -6300000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 2.95 \cdot 10^{-95}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 2 \cdot 10^{-48}:\\
\;\;\;\;\frac{x}{\frac{y}{x}}\\

\mathbf{elif}\;x \leq 1400:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.3e6 or 1400 < x

    1. Initial program 73.2%

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

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

        \[\leadsto \frac{x \cdot \left(\frac{x}{y} + 1\right)}{\color{blue}{x}} \]
      2. Taylor expanded in y around 0

        \[\leadsto \color{blue}{\frac{x + y}{y}} \]
      3. Step-by-step derivation
        1. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, y\right), y\right) \]
      4. Simplified99.4%

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

      if -6.3e6 < x < 2.9499999999999999e-95 or 1.9999999999999999e-48 < x < 1400

      1. Initial program 99.9%

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

          \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
        2. *-lowering-*.f64N/A

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
      3. Simplified99.8%

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
      4. Add Preprocessing
      5. Taylor expanded in y around inf

        \[\leadsto \color{blue}{\frac{x}{1 + x}} \]
      6. Step-by-step derivation
        1. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{\left(1 + x\right)}\right) \]
        2. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(x, \left(x + \color{blue}{1}\right)\right) \]
        3. +-lowering-+.f6477.5%

          \[\leadsto \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right) \]
      7. Simplified77.5%

        \[\leadsto \color{blue}{\frac{x}{x + 1}} \]

      if 2.9499999999999999e-95 < x < 1.9999999999999999e-48

      1. Initial program 99.8%

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

          \[\leadsto \mathsf{/.f64}\left(\left(\left(\frac{x}{y} + 1\right) \cdot x\right), \mathsf{+.f64}\left(\color{blue}{x}, 1\right)\right) \]
        2. distribute-lft1-inN/A

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{x}{\frac{y}{x}}\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{y}{x}\right)\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
        6. /-lowering-/.f6499.9%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, x\right)\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
      4. Applied egg-rr99.9%

        \[\leadsto \frac{\color{blue}{\frac{x}{\frac{y}{x}} + x}}{x + 1} \]
      5. Taylor expanded in x around 0

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, x\right)\right), x\right), \color{blue}{1}\right) \]
      6. Step-by-step derivation
        1. Simplified99.9%

          \[\leadsto \frac{\frac{x}{\frac{y}{x}} + x}{\color{blue}{1}} \]
        2. Step-by-step derivation
          1. /-rgt-identityN/A

            \[\leadsto \frac{x}{\frac{y}{x}} + \color{blue}{x} \]
          2. associate-/r/N/A

            \[\leadsto \frac{x}{y} \cdot x + x \]
          3. associate-*l/N/A

            \[\leadsto \frac{x \cdot x}{y} + x \]
          4. remove-double-divN/A

            \[\leadsto \frac{x \cdot x}{y} + \frac{1}{\color{blue}{\frac{1}{x}}} \]
          5. frac-addN/A

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

            \[\leadsto \frac{x \cdot \left(x \cdot \frac{1}{x}\right) + y \cdot 1}{y \cdot \frac{1}{x}} \]
          7. rgt-mult-inverseN/A

            \[\leadsto \frac{x \cdot 1 + y \cdot 1}{y \cdot \frac{1}{x}} \]
          8. *-rgt-identityN/A

            \[\leadsto \frac{x + y \cdot 1}{y \cdot \frac{1}{x}} \]
          9. *-rgt-identityN/A

            \[\leadsto \frac{x + y}{y \cdot \frac{1}{x}} \]
          10. div-invN/A

            \[\leadsto \frac{x + y}{\frac{y}{\color{blue}{x}}} \]
          11. /-lowering-/.f64N/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, y\right), \left(\frac{\color{blue}{y}}{x}\right)\right) \]
          13. /-lowering-/.f6492.5%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, y\right), \mathsf{/.f64}\left(y, \color{blue}{x}\right)\right) \]
        3. Applied egg-rr92.5%

          \[\leadsto \color{blue}{\frac{x + y}{\frac{y}{x}}} \]
        4. Taylor expanded in x around inf

          \[\leadsto \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(y, x\right)\right) \]
        5. Step-by-step derivation
          1. Simplified83.9%

            \[\leadsto \frac{\color{blue}{x}}{\frac{y}{x}} \]
        6. Recombined 3 regimes into one program.
        7. Add Preprocessing

        Alternative 3: 73.9% accurate, 0.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{x + 1}\\ \mathbf{if}\;x \leq -1.75 \cdot 10^{+21}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-95}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-46}:\\ \;\;\;\;\frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq 2.45 \cdot 10^{+30}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
        (FPCore (x y)
         :precision binary64
         (let* ((t_0 (/ x (+ x 1.0))))
           (if (<= x -1.75e+21)
             (/ x y)
             (if (<= x 3.6e-95)
               t_0
               (if (<= x 2.3e-46) (/ x (/ y x)) (if (<= x 2.45e+30) t_0 (/ x y)))))))
        double code(double x, double y) {
        	double t_0 = x / (x + 1.0);
        	double tmp;
        	if (x <= -1.75e+21) {
        		tmp = x / y;
        	} else if (x <= 3.6e-95) {
        		tmp = t_0;
        	} else if (x <= 2.3e-46) {
        		tmp = x / (y / x);
        	} else if (x <= 2.45e+30) {
        		tmp = t_0;
        	} else {
        		tmp = x / y;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8) :: t_0
            real(8) :: tmp
            t_0 = x / (x + 1.0d0)
            if (x <= (-1.75d+21)) then
                tmp = x / y
            else if (x <= 3.6d-95) then
                tmp = t_0
            else if (x <= 2.3d-46) then
                tmp = x / (y / x)
            else if (x <= 2.45d+30) then
                tmp = t_0
            else
                tmp = x / y
            end if
            code = tmp
        end function
        
        public static double code(double x, double y) {
        	double t_0 = x / (x + 1.0);
        	double tmp;
        	if (x <= -1.75e+21) {
        		tmp = x / y;
        	} else if (x <= 3.6e-95) {
        		tmp = t_0;
        	} else if (x <= 2.3e-46) {
        		tmp = x / (y / x);
        	} else if (x <= 2.45e+30) {
        		tmp = t_0;
        	} else {
        		tmp = x / y;
        	}
        	return tmp;
        }
        
        def code(x, y):
        	t_0 = x / (x + 1.0)
        	tmp = 0
        	if x <= -1.75e+21:
        		tmp = x / y
        	elif x <= 3.6e-95:
        		tmp = t_0
        	elif x <= 2.3e-46:
        		tmp = x / (y / x)
        	elif x <= 2.45e+30:
        		tmp = t_0
        	else:
        		tmp = x / y
        	return tmp
        
        function code(x, y)
        	t_0 = Float64(x / Float64(x + 1.0))
        	tmp = 0.0
        	if (x <= -1.75e+21)
        		tmp = Float64(x / y);
        	elseif (x <= 3.6e-95)
        		tmp = t_0;
        	elseif (x <= 2.3e-46)
        		tmp = Float64(x / Float64(y / x));
        	elseif (x <= 2.45e+30)
        		tmp = t_0;
        	else
        		tmp = Float64(x / y);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y)
        	t_0 = x / (x + 1.0);
        	tmp = 0.0;
        	if (x <= -1.75e+21)
        		tmp = x / y;
        	elseif (x <= 3.6e-95)
        		tmp = t_0;
        	elseif (x <= 2.3e-46)
        		tmp = x / (y / x);
        	elseif (x <= 2.45e+30)
        		tmp = t_0;
        	else
        		tmp = x / y;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.75e+21], N[(x / y), $MachinePrecision], If[LessEqual[x, 3.6e-95], t$95$0, If[LessEqual[x, 2.3e-46], N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.45e+30], t$95$0, N[(x / y), $MachinePrecision]]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{x}{x + 1}\\
        \mathbf{if}\;x \leq -1.75 \cdot 10^{+21}:\\
        \;\;\;\;\frac{x}{y}\\
        
        \mathbf{elif}\;x \leq 3.6 \cdot 10^{-95}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;x \leq 2.3 \cdot 10^{-46}:\\
        \;\;\;\;\frac{x}{\frac{y}{x}}\\
        
        \mathbf{elif}\;x \leq 2.45 \cdot 10^{+30}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{x}{y}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if x < -1.75e21 or 2.44999999999999992e30 < x

          1. Initial program 72.0%

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

              \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
            2. *-lowering-*.f64N/A

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

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

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

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

              \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
          3. Simplified99.9%

            \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
          4. Add Preprocessing
          5. Taylor expanded in x around inf

            \[\leadsto \color{blue}{\frac{x}{y}} \]
          6. Step-by-step derivation
            1. /-lowering-/.f6478.2%

              \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{y}\right) \]
          7. Simplified78.2%

            \[\leadsto \color{blue}{\frac{x}{y}} \]

          if -1.75e21 < x < 3.6e-95 or 2.2999999999999999e-46 < x < 2.44999999999999992e30

          1. Initial program 99.9%

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

              \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
            2. *-lowering-*.f64N/A

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

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

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

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

              \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
          3. Simplified99.8%

            \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
          4. Add Preprocessing
          5. Taylor expanded in y around inf

            \[\leadsto \color{blue}{\frac{x}{1 + x}} \]
          6. Step-by-step derivation
            1. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{\left(1 + x\right)}\right) \]
            2. +-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(x, \left(x + \color{blue}{1}\right)\right) \]
            3. +-lowering-+.f6476.8%

              \[\leadsto \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right) \]
          7. Simplified76.8%

            \[\leadsto \color{blue}{\frac{x}{x + 1}} \]

          if 3.6e-95 < x < 2.2999999999999999e-46

          1. Initial program 99.8%

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

              \[\leadsto \mathsf{/.f64}\left(\left(\left(\frac{x}{y} + 1\right) \cdot x\right), \mathsf{+.f64}\left(\color{blue}{x}, 1\right)\right) \]
            2. distribute-lft1-inN/A

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{x}{\frac{y}{x}}\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
            5. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{y}{x}\right)\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
            6. /-lowering-/.f6499.9%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, x\right)\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
          4. Applied egg-rr99.9%

            \[\leadsto \frac{\color{blue}{\frac{x}{\frac{y}{x}} + x}}{x + 1} \]
          5. Taylor expanded in x around 0

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, x\right)\right), x\right), \color{blue}{1}\right) \]
          6. Step-by-step derivation
            1. Simplified99.9%

              \[\leadsto \frac{\frac{x}{\frac{y}{x}} + x}{\color{blue}{1}} \]
            2. Step-by-step derivation
              1. /-rgt-identityN/A

                \[\leadsto \frac{x}{\frac{y}{x}} + \color{blue}{x} \]
              2. associate-/r/N/A

                \[\leadsto \frac{x}{y} \cdot x + x \]
              3. associate-*l/N/A

                \[\leadsto \frac{x \cdot x}{y} + x \]
              4. remove-double-divN/A

                \[\leadsto \frac{x \cdot x}{y} + \frac{1}{\color{blue}{\frac{1}{x}}} \]
              5. frac-addN/A

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

                \[\leadsto \frac{x \cdot \left(x \cdot \frac{1}{x}\right) + y \cdot 1}{y \cdot \frac{1}{x}} \]
              7. rgt-mult-inverseN/A

                \[\leadsto \frac{x \cdot 1 + y \cdot 1}{y \cdot \frac{1}{x}} \]
              8. *-rgt-identityN/A

                \[\leadsto \frac{x + y \cdot 1}{y \cdot \frac{1}{x}} \]
              9. *-rgt-identityN/A

                \[\leadsto \frac{x + y}{y \cdot \frac{1}{x}} \]
              10. div-invN/A

                \[\leadsto \frac{x + y}{\frac{y}{\color{blue}{x}}} \]
              11. /-lowering-/.f64N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, y\right), \left(\frac{\color{blue}{y}}{x}\right)\right) \]
              13. /-lowering-/.f6492.5%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, y\right), \mathsf{/.f64}\left(y, \color{blue}{x}\right)\right) \]
            3. Applied egg-rr92.5%

              \[\leadsto \color{blue}{\frac{x + y}{\frac{y}{x}}} \]
            4. Taylor expanded in x around inf

              \[\leadsto \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(y, x\right)\right) \]
            5. Step-by-step derivation
              1. Simplified83.9%

                \[\leadsto \frac{\color{blue}{x}}{\frac{y}{x}} \]
            6. Recombined 3 regimes into one program.
            7. Add Preprocessing

            Alternative 4: 73.8% accurate, 0.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{x + 1}\\ \mathbf{if}\;x \leq -5.5 \cdot 10^{+21}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-95}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-47}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+30}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
            (FPCore (x y)
             :precision binary64
             (let* ((t_0 (/ x (+ x 1.0))))
               (if (<= x -5.5e+21)
                 (/ x y)
                 (if (<= x 3.6e-95)
                   t_0
                   (if (<= x 4.5e-47) (* x (/ x y)) (if (<= x 1.3e+30) t_0 (/ x y)))))))
            double code(double x, double y) {
            	double t_0 = x / (x + 1.0);
            	double tmp;
            	if (x <= -5.5e+21) {
            		tmp = x / y;
            	} else if (x <= 3.6e-95) {
            		tmp = t_0;
            	} else if (x <= 4.5e-47) {
            		tmp = x * (x / y);
            	} else if (x <= 1.3e+30) {
            		tmp = t_0;
            	} else {
            		tmp = x / y;
            	}
            	return tmp;
            }
            
            real(8) function code(x, y)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8) :: t_0
                real(8) :: tmp
                t_0 = x / (x + 1.0d0)
                if (x <= (-5.5d+21)) then
                    tmp = x / y
                else if (x <= 3.6d-95) then
                    tmp = t_0
                else if (x <= 4.5d-47) then
                    tmp = x * (x / y)
                else if (x <= 1.3d+30) then
                    tmp = t_0
                else
                    tmp = x / y
                end if
                code = tmp
            end function
            
            public static double code(double x, double y) {
            	double t_0 = x / (x + 1.0);
            	double tmp;
            	if (x <= -5.5e+21) {
            		tmp = x / y;
            	} else if (x <= 3.6e-95) {
            		tmp = t_0;
            	} else if (x <= 4.5e-47) {
            		tmp = x * (x / y);
            	} else if (x <= 1.3e+30) {
            		tmp = t_0;
            	} else {
            		tmp = x / y;
            	}
            	return tmp;
            }
            
            def code(x, y):
            	t_0 = x / (x + 1.0)
            	tmp = 0
            	if x <= -5.5e+21:
            		tmp = x / y
            	elif x <= 3.6e-95:
            		tmp = t_0
            	elif x <= 4.5e-47:
            		tmp = x * (x / y)
            	elif x <= 1.3e+30:
            		tmp = t_0
            	else:
            		tmp = x / y
            	return tmp
            
            function code(x, y)
            	t_0 = Float64(x / Float64(x + 1.0))
            	tmp = 0.0
            	if (x <= -5.5e+21)
            		tmp = Float64(x / y);
            	elseif (x <= 3.6e-95)
            		tmp = t_0;
            	elseif (x <= 4.5e-47)
            		tmp = Float64(x * Float64(x / y));
            	elseif (x <= 1.3e+30)
            		tmp = t_0;
            	else
            		tmp = Float64(x / y);
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y)
            	t_0 = x / (x + 1.0);
            	tmp = 0.0;
            	if (x <= -5.5e+21)
            		tmp = x / y;
            	elseif (x <= 3.6e-95)
            		tmp = t_0;
            	elseif (x <= 4.5e-47)
            		tmp = x * (x / y);
            	elseif (x <= 1.3e+30)
            		tmp = t_0;
            	else
            		tmp = x / y;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.5e+21], N[(x / y), $MachinePrecision], If[LessEqual[x, 3.6e-95], t$95$0, If[LessEqual[x, 4.5e-47], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.3e+30], t$95$0, N[(x / y), $MachinePrecision]]]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := \frac{x}{x + 1}\\
            \mathbf{if}\;x \leq -5.5 \cdot 10^{+21}:\\
            \;\;\;\;\frac{x}{y}\\
            
            \mathbf{elif}\;x \leq 3.6 \cdot 10^{-95}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;x \leq 4.5 \cdot 10^{-47}:\\
            \;\;\;\;x \cdot \frac{x}{y}\\
            
            \mathbf{elif}\;x \leq 1.3 \cdot 10^{+30}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{x}{y}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if x < -5.5e21 or 1.29999999999999994e30 < x

              1. Initial program 72.0%

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

                  \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
                2. *-lowering-*.f64N/A

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
              3. Simplified99.9%

                \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
              4. Add Preprocessing
              5. Taylor expanded in x around inf

                \[\leadsto \color{blue}{\frac{x}{y}} \]
              6. Step-by-step derivation
                1. /-lowering-/.f6478.2%

                  \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{y}\right) \]
              7. Simplified78.2%

                \[\leadsto \color{blue}{\frac{x}{y}} \]

              if -5.5e21 < x < 3.6e-95 or 4.5e-47 < x < 1.29999999999999994e30

              1. Initial program 99.9%

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

                  \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
                2. *-lowering-*.f64N/A

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
              3. Simplified99.8%

                \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
              4. Add Preprocessing
              5. Taylor expanded in y around inf

                \[\leadsto \color{blue}{\frac{x}{1 + x}} \]
              6. Step-by-step derivation
                1. /-lowering-/.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{\left(1 + x\right)}\right) \]
                2. +-commutativeN/A

                  \[\leadsto \mathsf{/.f64}\left(x, \left(x + \color{blue}{1}\right)\right) \]
                3. +-lowering-+.f6476.8%

                  \[\leadsto \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right) \]
              7. Simplified76.8%

                \[\leadsto \color{blue}{\frac{x}{x + 1}} \]

              if 3.6e-95 < x < 4.5e-47

              1. Initial program 99.8%

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

                  \[\leadsto \mathsf{/.f64}\left(\left(\left(\frac{x}{y} + 1\right) \cdot x\right), \mathsf{+.f64}\left(\color{blue}{x}, 1\right)\right) \]
                2. distribute-lft1-inN/A

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

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

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{x}{\frac{y}{x}}\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
                5. /-lowering-/.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{y}{x}\right)\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
                6. /-lowering-/.f6499.9%

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, x\right)\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
              4. Applied egg-rr99.9%

                \[\leadsto \frac{\color{blue}{\frac{x}{\frac{y}{x}} + x}}{x + 1} \]
              5. Taylor expanded in x around 0

                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, x\right)\right), x\right), \color{blue}{1}\right) \]
              6. Step-by-step derivation
                1. Simplified99.9%

                  \[\leadsto \frac{\frac{x}{\frac{y}{x}} + x}{\color{blue}{1}} \]
                2. Step-by-step derivation
                  1. /-rgt-identityN/A

                    \[\leadsto \frac{x}{\frac{y}{x}} + \color{blue}{x} \]
                  2. associate-/r/N/A

                    \[\leadsto \frac{x}{y} \cdot x + x \]
                  3. distribute-lft1-inN/A

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

                    \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{y} + 1\right), \color{blue}{x}\right) \]
                  5. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\left(1 + \frac{x}{y}\right), x\right) \]
                  6. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{x}{y}\right)\right), x\right) \]
                  7. /-lowering-/.f6499.8%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(x, y\right)\right), x\right) \]
                3. Applied egg-rr99.8%

                  \[\leadsto \color{blue}{\left(1 + \frac{x}{y}\right) \cdot x} \]
                4. Taylor expanded in x around inf

                  \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{x}{y}\right)}, x\right) \]
                5. Step-by-step derivation
                  1. /-lowering-/.f6483.8%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), x\right) \]
                6. Simplified83.8%

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{+21}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-95}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-47}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+30}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
              9. Add Preprocessing

              Alternative 5: 73.8% accurate, 0.4× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(1 - x\right)\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-95}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.55 \cdot 10^{-47}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 0.32:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
              (FPCore (x y)
               :precision binary64
               (let* ((t_0 (* x (- 1.0 x))))
                 (if (<= x -1.0)
                   (/ x y)
                   (if (<= x 3.6e-95)
                     t_0
                     (if (<= x 1.55e-47) (* x (/ x y)) (if (<= x 0.32) t_0 (/ x y)))))))
              double code(double x, double y) {
              	double t_0 = x * (1.0 - x);
              	double tmp;
              	if (x <= -1.0) {
              		tmp = x / y;
              	} else if (x <= 3.6e-95) {
              		tmp = t_0;
              	} else if (x <= 1.55e-47) {
              		tmp = x * (x / y);
              	} else if (x <= 0.32) {
              		tmp = t_0;
              	} else {
              		tmp = x / y;
              	}
              	return tmp;
              }
              
              real(8) function code(x, y)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8) :: t_0
                  real(8) :: tmp
                  t_0 = x * (1.0d0 - x)
                  if (x <= (-1.0d0)) then
                      tmp = x / y
                  else if (x <= 3.6d-95) then
                      tmp = t_0
                  else if (x <= 1.55d-47) then
                      tmp = x * (x / y)
                  else if (x <= 0.32d0) then
                      tmp = t_0
                  else
                      tmp = x / y
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y) {
              	double t_0 = x * (1.0 - x);
              	double tmp;
              	if (x <= -1.0) {
              		tmp = x / y;
              	} else if (x <= 3.6e-95) {
              		tmp = t_0;
              	} else if (x <= 1.55e-47) {
              		tmp = x * (x / y);
              	} else if (x <= 0.32) {
              		tmp = t_0;
              	} else {
              		tmp = x / y;
              	}
              	return tmp;
              }
              
              def code(x, y):
              	t_0 = x * (1.0 - x)
              	tmp = 0
              	if x <= -1.0:
              		tmp = x / y
              	elif x <= 3.6e-95:
              		tmp = t_0
              	elif x <= 1.55e-47:
              		tmp = x * (x / y)
              	elif x <= 0.32:
              		tmp = t_0
              	else:
              		tmp = x / y
              	return tmp
              
              function code(x, y)
              	t_0 = Float64(x * Float64(1.0 - x))
              	tmp = 0.0
              	if (x <= -1.0)
              		tmp = Float64(x / y);
              	elseif (x <= 3.6e-95)
              		tmp = t_0;
              	elseif (x <= 1.55e-47)
              		tmp = Float64(x * Float64(x / y));
              	elseif (x <= 0.32)
              		tmp = t_0;
              	else
              		tmp = Float64(x / y);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y)
              	t_0 = x * (1.0 - x);
              	tmp = 0.0;
              	if (x <= -1.0)
              		tmp = x / y;
              	elseif (x <= 3.6e-95)
              		tmp = t_0;
              	elseif (x <= 1.55e-47)
              		tmp = x * (x / y);
              	elseif (x <= 0.32)
              		tmp = t_0;
              	else
              		tmp = x / y;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_] := Block[{t$95$0 = N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 3.6e-95], t$95$0, If[LessEqual[x, 1.55e-47], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.32], t$95$0, N[(x / y), $MachinePrecision]]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := x \cdot \left(1 - x\right)\\
              \mathbf{if}\;x \leq -1:\\
              \;\;\;\;\frac{x}{y}\\
              
              \mathbf{elif}\;x \leq 3.6 \cdot 10^{-95}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;x \leq 1.55 \cdot 10^{-47}:\\
              \;\;\;\;x \cdot \frac{x}{y}\\
              
              \mathbf{elif}\;x \leq 0.32:\\
              \;\;\;\;t\_0\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{x}{y}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if x < -1 or 0.320000000000000007 < x

                1. Initial program 74.2%

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

                    \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
                  2. *-lowering-*.f64N/A

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

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                3. Simplified99.9%

                  \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
                4. Add Preprocessing
                5. Taylor expanded in x around inf

                  \[\leadsto \color{blue}{\frac{x}{y}} \]
                6. Step-by-step derivation
                  1. /-lowering-/.f6473.7%

                    \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{y}\right) \]
                7. Simplified73.7%

                  \[\leadsto \color{blue}{\frac{x}{y}} \]

                if -1 < x < 3.6e-95 or 1.5499999999999999e-47 < x < 0.320000000000000007

                1. Initial program 99.9%

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

                    \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
                  2. *-lowering-*.f64N/A

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

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                3. Simplified99.9%

                  \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
                4. Add Preprocessing
                5. Taylor expanded in y around inf

                  \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{1}{1 + x}\right)}\right) \]
                6. Step-by-step derivation
                  1. /-lowering-/.f64N/A

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

                    \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \left(x + \color{blue}{1}\right)\right)\right) \]
                  3. +-lowering-+.f6478.1%

                    \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                7. Simplified78.1%

                  \[\leadsto x \cdot \color{blue}{\frac{1}{x + 1}} \]
                8. Taylor expanded in x around 0

                  \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot x\right)} \]
                9. Step-by-step derivation
                  1. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -1 \cdot x\right)}\right) \]
                  2. mul-1-negN/A

                    \[\leadsto \mathsf{*.f64}\left(x, \left(1 + \left(\mathsf{neg}\left(x\right)\right)\right)\right) \]
                  3. unsub-negN/A

                    \[\leadsto \mathsf{*.f64}\left(x, \left(1 - \color{blue}{x}\right)\right) \]
                  4. --lowering--.f6477.5%

                    \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(1, \color{blue}{x}\right)\right) \]
                10. Simplified77.5%

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

                if 3.6e-95 < x < 1.5499999999999999e-47

                1. Initial program 99.8%

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

                    \[\leadsto \mathsf{/.f64}\left(\left(\left(\frac{x}{y} + 1\right) \cdot x\right), \mathsf{+.f64}\left(\color{blue}{x}, 1\right)\right) \]
                  2. distribute-lft1-inN/A

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

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

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{x}{\frac{y}{x}}\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
                  5. /-lowering-/.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{y}{x}\right)\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
                  6. /-lowering-/.f6499.9%

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, x\right)\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
                4. Applied egg-rr99.9%

                  \[\leadsto \frac{\color{blue}{\frac{x}{\frac{y}{x}} + x}}{x + 1} \]
                5. Taylor expanded in x around 0

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, x\right)\right), x\right), \color{blue}{1}\right) \]
                6. Step-by-step derivation
                  1. Simplified99.9%

                    \[\leadsto \frac{\frac{x}{\frac{y}{x}} + x}{\color{blue}{1}} \]
                  2. Step-by-step derivation
                    1. /-rgt-identityN/A

                      \[\leadsto \frac{x}{\frac{y}{x}} + \color{blue}{x} \]
                    2. associate-/r/N/A

                      \[\leadsto \frac{x}{y} \cdot x + x \]
                    3. distribute-lft1-inN/A

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

                      \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{y} + 1\right), \color{blue}{x}\right) \]
                    5. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(\left(1 + \frac{x}{y}\right), x\right) \]
                    6. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{x}{y}\right)\right), x\right) \]
                    7. /-lowering-/.f6499.8%

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(x, y\right)\right), x\right) \]
                  3. Applied egg-rr99.8%

                    \[\leadsto \color{blue}{\left(1 + \frac{x}{y}\right) \cdot x} \]
                  4. Taylor expanded in x around inf

                    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{x}{y}\right)}, x\right) \]
                  5. Step-by-step derivation
                    1. /-lowering-/.f6483.8%

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), x\right) \]
                  6. Simplified83.8%

                    \[\leadsto \color{blue}{\frac{x}{y}} \cdot x \]
                7. Recombined 3 regimes into one program.
                8. Final simplification76.0%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-95}:\\ \;\;\;\;x \cdot \left(1 - x\right)\\ \mathbf{elif}\;x \leq 1.55 \cdot 10^{-47}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 0.32:\\ \;\;\;\;x \cdot \left(1 - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
                9. Add Preprocessing

                Alternative 6: 98.1% accurate, 0.6× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y}{y}\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 0.85:\\ \;\;\;\;x \cdot \left(\left(\frac{x}{y} + 1\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                (FPCore (x y)
                 :precision binary64
                 (let* ((t_0 (/ (+ x y) y)))
                   (if (<= x -1.0) t_0 (if (<= x 0.85) (* x (- (+ (/ x y) 1.0) x)) t_0))))
                double code(double x, double y) {
                	double t_0 = (x + y) / y;
                	double tmp;
                	if (x <= -1.0) {
                		tmp = t_0;
                	} else if (x <= 0.85) {
                		tmp = x * (((x / y) + 1.0) - x);
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                real(8) function code(x, y)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8) :: t_0
                    real(8) :: tmp
                    t_0 = (x + y) / y
                    if (x <= (-1.0d0)) then
                        tmp = t_0
                    else if (x <= 0.85d0) then
                        tmp = x * (((x / y) + 1.0d0) - x)
                    else
                        tmp = t_0
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y) {
                	double t_0 = (x + y) / y;
                	double tmp;
                	if (x <= -1.0) {
                		tmp = t_0;
                	} else if (x <= 0.85) {
                		tmp = x * (((x / y) + 1.0) - x);
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                def code(x, y):
                	t_0 = (x + y) / y
                	tmp = 0
                	if x <= -1.0:
                		tmp = t_0
                	elif x <= 0.85:
                		tmp = x * (((x / y) + 1.0) - x)
                	else:
                		tmp = t_0
                	return tmp
                
                function code(x, y)
                	t_0 = Float64(Float64(x + y) / y)
                	tmp = 0.0
                	if (x <= -1.0)
                		tmp = t_0;
                	elseif (x <= 0.85)
                		tmp = Float64(x * Float64(Float64(Float64(x / y) + 1.0) - x));
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y)
                	t_0 = (x + y) / y;
                	tmp = 0.0;
                	if (x <= -1.0)
                		tmp = t_0;
                	elseif (x <= 0.85)
                		tmp = x * (((x / y) + 1.0) - x);
                	else
                		tmp = t_0;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 0.85], N[(x * N[(N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \frac{x + y}{y}\\
                \mathbf{if}\;x \leq -1:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;x \leq 0.85:\\
                \;\;\;\;x \cdot \left(\left(\frac{x}{y} + 1\right) - x\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if x < -1 or 0.849999999999999978 < x

                  1. Initial program 74.2%

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

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right)\right), \color{blue}{x}\right) \]
                  4. Step-by-step derivation
                    1. Simplified71.3%

                      \[\leadsto \frac{x \cdot \left(\frac{x}{y} + 1\right)}{\color{blue}{x}} \]
                    2. Taylor expanded in y around 0

                      \[\leadsto \color{blue}{\frac{x + y}{y}} \]
                    3. Step-by-step derivation
                      1. /-lowering-/.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\left(x + y\right), \color{blue}{y}\right) \]
                      2. +-lowering-+.f6497.0%

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, y\right), y\right) \]
                    4. Simplified97.0%

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

                    if -1 < x < 0.849999999999999978

                    1. Initial program 99.9%

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

                        \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
                      2. *-lowering-*.f64N/A

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

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                    3. Simplified99.8%

                      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
                    4. Add Preprocessing
                    5. Taylor expanded in x around 0

                      \[\leadsto \color{blue}{x \cdot \left(1 + x \cdot \left(\frac{1}{y} - 1\right)\right)} \]
                    6. Step-by-step derivation
                      1. *-lowering-*.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(1 + x \cdot \left(\frac{1}{y} - 1\right)\right)}\right) \]
                      2. sub-negN/A

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

                        \[\leadsto \mathsf{*.f64}\left(x, \left(1 + x \cdot \left(\frac{1}{y} + -1\right)\right)\right) \]
                      4. distribute-rgt-inN/A

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(1 + \frac{x}{y}\right) + \color{blue}{-1 \cdot x}\right)\right) \]
                      8. lft-mult-inverseN/A

                        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\frac{1}{x} \cdot x + \frac{x}{y}\right) + -1 \cdot x\right)\right) \]
                      9. *-lft-identityN/A

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

                        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\frac{1}{x} \cdot x + \frac{1}{y} \cdot x\right) + -1 \cdot x\right)\right) \]
                      11. distribute-rgt-inN/A

                        \[\leadsto \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{x} + \frac{1}{y}\right) + \color{blue}{-1} \cdot x\right)\right) \]
                      12. mul-1-negN/A

                        \[\leadsto \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{x} + \frac{1}{y}\right) + \left(\mathsf{neg}\left(x\right)\right)\right)\right) \]
                      13. unsub-negN/A

                        \[\leadsto \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{x} + \frac{1}{y}\right) - \color{blue}{x}\right)\right) \]
                      14. --lowering--.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\left(x \cdot \left(\frac{1}{x} + \frac{1}{y}\right)\right), \color{blue}{x}\right)\right) \]
                      15. distribute-rgt-inN/A

                        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{1}{x} \cdot x + \frac{1}{y} \cdot x\right), x\right)\right) \]
                      16. lft-mult-inverseN/A

                        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\left(1 + \frac{1}{y} \cdot x\right), x\right)\right) \]
                      17. associate-*l/N/A

                        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\left(1 + \frac{1 \cdot x}{y}\right), x\right)\right) \]
                      18. *-lft-identityN/A

                        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\left(1 + \frac{x}{y}\right), x\right)\right) \]
                      19. +-lowering-+.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{x}{y}\right)\right), x\right)\right) \]
                      20. /-lowering-/.f6498.4%

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

                      \[\leadsto \color{blue}{x \cdot \left(\left(1 + \frac{x}{y}\right) - x\right)} \]
                  5. Recombined 2 regimes into one program.
                  6. Final simplification97.7%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{x + y}{y}\\ \mathbf{elif}\;x \leq 0.85:\\ \;\;\;\;x \cdot \left(\left(\frac{x}{y} + 1\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y}{y}\\ \end{array} \]
                  7. Add Preprocessing

                  Alternative 7: 97.8% accurate, 0.6× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y}{y}\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x \cdot \left(\frac{x}{y} + 1\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                  (FPCore (x y)
                   :precision binary64
                   (let* ((t_0 (/ (+ x y) y)))
                     (if (<= x -1.0) t_0 (if (<= x 1.0) (* x (+ (/ x y) 1.0)) t_0))))
                  double code(double x, double y) {
                  	double t_0 = (x + y) / y;
                  	double tmp;
                  	if (x <= -1.0) {
                  		tmp = t_0;
                  	} else if (x <= 1.0) {
                  		tmp = x * ((x / y) + 1.0);
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  real(8) function code(x, y)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8) :: t_0
                      real(8) :: tmp
                      t_0 = (x + y) / y
                      if (x <= (-1.0d0)) then
                          tmp = t_0
                      else if (x <= 1.0d0) then
                          tmp = x * ((x / y) + 1.0d0)
                      else
                          tmp = t_0
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double y) {
                  	double t_0 = (x + y) / y;
                  	double tmp;
                  	if (x <= -1.0) {
                  		tmp = t_0;
                  	} else if (x <= 1.0) {
                  		tmp = x * ((x / y) + 1.0);
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y):
                  	t_0 = (x + y) / y
                  	tmp = 0
                  	if x <= -1.0:
                  		tmp = t_0
                  	elif x <= 1.0:
                  		tmp = x * ((x / y) + 1.0)
                  	else:
                  		tmp = t_0
                  	return tmp
                  
                  function code(x, y)
                  	t_0 = Float64(Float64(x + y) / y)
                  	tmp = 0.0
                  	if (x <= -1.0)
                  		tmp = t_0;
                  	elseif (x <= 1.0)
                  		tmp = Float64(x * Float64(Float64(x / y) + 1.0));
                  	else
                  		tmp = t_0;
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y)
                  	t_0 = (x + y) / y;
                  	tmp = 0.0;
                  	if (x <= -1.0)
                  		tmp = t_0;
                  	elseif (x <= 1.0)
                  		tmp = x * ((x / y) + 1.0);
                  	else
                  		tmp = t_0;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 1.0], N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  t_0 := \frac{x + y}{y}\\
                  \mathbf{if}\;x \leq -1:\\
                  \;\;\;\;t\_0\\
                  
                  \mathbf{elif}\;x \leq 1:\\
                  \;\;\;\;x \cdot \left(\frac{x}{y} + 1\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_0\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if x < -1 or 1 < x

                    1. Initial program 74.2%

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

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right)\right), \color{blue}{x}\right) \]
                    4. Step-by-step derivation
                      1. Simplified71.3%

                        \[\leadsto \frac{x \cdot \left(\frac{x}{y} + 1\right)}{\color{blue}{x}} \]
                      2. Taylor expanded in y around 0

                        \[\leadsto \color{blue}{\frac{x + y}{y}} \]
                      3. Step-by-step derivation
                        1. /-lowering-/.f64N/A

                          \[\leadsto \mathsf{/.f64}\left(\left(x + y\right), \color{blue}{y}\right) \]
                        2. +-lowering-+.f6497.0%

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, y\right), y\right) \]
                      4. Simplified97.0%

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

                      if -1 < x < 1

                      1. Initial program 99.9%

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

                          \[\leadsto \mathsf{/.f64}\left(\left(\left(\frac{x}{y} + 1\right) \cdot x\right), \mathsf{+.f64}\left(\color{blue}{x}, 1\right)\right) \]
                        2. distribute-lft1-inN/A

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

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

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{x}{\frac{y}{x}}\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
                        5. /-lowering-/.f64N/A

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{y}{x}\right)\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
                        6. /-lowering-/.f6499.9%

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, x\right)\right), x\right), \mathsf{+.f64}\left(x, 1\right)\right) \]
                      4. Applied egg-rr99.9%

                        \[\leadsto \frac{\color{blue}{\frac{x}{\frac{y}{x}} + x}}{x + 1} \]
                      5. Taylor expanded in x around 0

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, x\right)\right), x\right), \color{blue}{1}\right) \]
                      6. Step-by-step derivation
                        1. Simplified97.9%

                          \[\leadsto \frac{\frac{x}{\frac{y}{x}} + x}{\color{blue}{1}} \]
                        2. Step-by-step derivation
                          1. /-rgt-identityN/A

                            \[\leadsto \frac{x}{\frac{y}{x}} + \color{blue}{x} \]
                          2. associate-/r/N/A

                            \[\leadsto \frac{x}{y} \cdot x + x \]
                          3. distribute-lft1-inN/A

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

                            \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{y} + 1\right), \color{blue}{x}\right) \]
                          5. +-commutativeN/A

                            \[\leadsto \mathsf{*.f64}\left(\left(1 + \frac{x}{y}\right), x\right) \]
                          6. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{x}{y}\right)\right), x\right) \]
                          7. /-lowering-/.f6497.8%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(x, y\right)\right), x\right) \]
                        3. Applied egg-rr97.8%

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

                        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{x + y}{y}\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x \cdot \left(\frac{x}{y} + 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y}{y}\\ \end{array} \]
                      9. Add Preprocessing

                      Alternative 8: 74.5% accurate, 0.7× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 0.78:\\ \;\;\;\;x \cdot \left(1 - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
                      (FPCore (x y)
                       :precision binary64
                       (if (<= x -1.0) (/ x y) (if (<= x 0.78) (* x (- 1.0 x)) (/ x y))))
                      double code(double x, double y) {
                      	double tmp;
                      	if (x <= -1.0) {
                      		tmp = x / y;
                      	} else if (x <= 0.78) {
                      		tmp = x * (1.0 - x);
                      	} else {
                      		tmp = x / y;
                      	}
                      	return tmp;
                      }
                      
                      real(8) function code(x, y)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8) :: tmp
                          if (x <= (-1.0d0)) then
                              tmp = x / y
                          else if (x <= 0.78d0) then
                              tmp = x * (1.0d0 - x)
                          else
                              tmp = x / y
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double x, double y) {
                      	double tmp;
                      	if (x <= -1.0) {
                      		tmp = x / y;
                      	} else if (x <= 0.78) {
                      		tmp = x * (1.0 - x);
                      	} else {
                      		tmp = x / y;
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y):
                      	tmp = 0
                      	if x <= -1.0:
                      		tmp = x / y
                      	elif x <= 0.78:
                      		tmp = x * (1.0 - x)
                      	else:
                      		tmp = x / y
                      	return tmp
                      
                      function code(x, y)
                      	tmp = 0.0
                      	if (x <= -1.0)
                      		tmp = Float64(x / y);
                      	elseif (x <= 0.78)
                      		tmp = Float64(x * Float64(1.0 - x));
                      	else
                      		tmp = Float64(x / y);
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(x, y)
                      	tmp = 0.0;
                      	if (x <= -1.0)
                      		tmp = x / y;
                      	elseif (x <= 0.78)
                      		tmp = x * (1.0 - x);
                      	else
                      		tmp = x / y;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[x_, y_] := If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 0.78], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;x \leq -1:\\
                      \;\;\;\;\frac{x}{y}\\
                      
                      \mathbf{elif}\;x \leq 0.78:\\
                      \;\;\;\;x \cdot \left(1 - x\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{x}{y}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if x < -1 or 0.78000000000000003 < x

                        1. Initial program 74.2%

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

                            \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
                          2. *-lowering-*.f64N/A

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                        3. Simplified99.9%

                          \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
                        4. Add Preprocessing
                        5. Taylor expanded in x around inf

                          \[\leadsto \color{blue}{\frac{x}{y}} \]
                        6. Step-by-step derivation
                          1. /-lowering-/.f6473.7%

                            \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{y}\right) \]
                        7. Simplified73.7%

                          \[\leadsto \color{blue}{\frac{x}{y}} \]

                        if -1 < x < 0.78000000000000003

                        1. Initial program 99.9%

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

                            \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
                          2. *-lowering-*.f64N/A

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                        3. Simplified99.8%

                          \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
                        4. Add Preprocessing
                        5. Taylor expanded in y around inf

                          \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{1}{1 + x}\right)}\right) \]
                        6. Step-by-step derivation
                          1. /-lowering-/.f64N/A

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

                            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \left(x + \color{blue}{1}\right)\right)\right) \]
                          3. +-lowering-+.f6472.2%

                            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                        7. Simplified72.2%

                          \[\leadsto x \cdot \color{blue}{\frac{1}{x + 1}} \]
                        8. Taylor expanded in x around 0

                          \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot x\right)} \]
                        9. Step-by-step derivation
                          1. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -1 \cdot x\right)}\right) \]
                          2. mul-1-negN/A

                            \[\leadsto \mathsf{*.f64}\left(x, \left(1 + \left(\mathsf{neg}\left(x\right)\right)\right)\right) \]
                          3. unsub-negN/A

                            \[\leadsto \mathsf{*.f64}\left(x, \left(1 - \color{blue}{x}\right)\right) \]
                          4. --lowering--.f6471.6%

                            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(1, \color{blue}{x}\right)\right) \]
                        10. Simplified71.6%

                          \[\leadsto \color{blue}{x \cdot \left(1 - x\right)} \]
                      3. Recombined 2 regimes into one program.
                      4. Add Preprocessing

                      Alternative 9: 74.2% accurate, 0.8× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 160:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
                      (FPCore (x y)
                       :precision binary64
                       (if (<= x -1.0) (/ x y) (if (<= x 160.0) x (/ x y))))
                      double code(double x, double y) {
                      	double tmp;
                      	if (x <= -1.0) {
                      		tmp = x / y;
                      	} else if (x <= 160.0) {
                      		tmp = x;
                      	} else {
                      		tmp = x / y;
                      	}
                      	return tmp;
                      }
                      
                      real(8) function code(x, y)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8) :: tmp
                          if (x <= (-1.0d0)) then
                              tmp = x / y
                          else if (x <= 160.0d0) then
                              tmp = x
                          else
                              tmp = x / y
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double x, double y) {
                      	double tmp;
                      	if (x <= -1.0) {
                      		tmp = x / y;
                      	} else if (x <= 160.0) {
                      		tmp = x;
                      	} else {
                      		tmp = x / y;
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y):
                      	tmp = 0
                      	if x <= -1.0:
                      		tmp = x / y
                      	elif x <= 160.0:
                      		tmp = x
                      	else:
                      		tmp = x / y
                      	return tmp
                      
                      function code(x, y)
                      	tmp = 0.0
                      	if (x <= -1.0)
                      		tmp = Float64(x / y);
                      	elseif (x <= 160.0)
                      		tmp = x;
                      	else
                      		tmp = Float64(x / y);
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(x, y)
                      	tmp = 0.0;
                      	if (x <= -1.0)
                      		tmp = x / y;
                      	elseif (x <= 160.0)
                      		tmp = x;
                      	else
                      		tmp = x / y;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[x_, y_] := If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 160.0], x, N[(x / y), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;x \leq -1:\\
                      \;\;\;\;\frac{x}{y}\\
                      
                      \mathbf{elif}\;x \leq 160:\\
                      \;\;\;\;x\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{x}{y}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if x < -1 or 160 < x

                        1. Initial program 74.0%

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

                            \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
                          2. *-lowering-*.f64N/A

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                        3. Simplified99.9%

                          \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
                        4. Add Preprocessing
                        5. Taylor expanded in x around inf

                          \[\leadsto \color{blue}{\frac{x}{y}} \]
                        6. Step-by-step derivation
                          1. /-lowering-/.f6474.3%

                            \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{y}\right) \]
                        7. Simplified74.3%

                          \[\leadsto \color{blue}{\frac{x}{y}} \]

                        if -1 < x < 160

                        1. Initial program 99.9%

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

                            \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
                          2. *-lowering-*.f64N/A

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                        3. Simplified99.8%

                          \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
                        4. Add Preprocessing
                        5. Taylor expanded in x around 0

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

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

                        Alternative 10: 49.9% accurate, 1.0× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
                        (FPCore (x y) :precision binary64 (if (<= x -1.0) 1.0 (if (<= x 1.0) x 1.0)))
                        double code(double x, double y) {
                        	double tmp;
                        	if (x <= -1.0) {
                        		tmp = 1.0;
                        	} else if (x <= 1.0) {
                        		tmp = x;
                        	} else {
                        		tmp = 1.0;
                        	}
                        	return tmp;
                        }
                        
                        real(8) function code(x, y)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            real(8) :: tmp
                            if (x <= (-1.0d0)) then
                                tmp = 1.0d0
                            else if (x <= 1.0d0) then
                                tmp = x
                            else
                                tmp = 1.0d0
                            end if
                            code = tmp
                        end function
                        
                        public static double code(double x, double y) {
                        	double tmp;
                        	if (x <= -1.0) {
                        		tmp = 1.0;
                        	} else if (x <= 1.0) {
                        		tmp = x;
                        	} else {
                        		tmp = 1.0;
                        	}
                        	return tmp;
                        }
                        
                        def code(x, y):
                        	tmp = 0
                        	if x <= -1.0:
                        		tmp = 1.0
                        	elif x <= 1.0:
                        		tmp = x
                        	else:
                        		tmp = 1.0
                        	return tmp
                        
                        function code(x, y)
                        	tmp = 0.0
                        	if (x <= -1.0)
                        		tmp = 1.0;
                        	elseif (x <= 1.0)
                        		tmp = x;
                        	else
                        		tmp = 1.0;
                        	end
                        	return tmp
                        end
                        
                        function tmp_2 = code(x, y)
                        	tmp = 0.0;
                        	if (x <= -1.0)
                        		tmp = 1.0;
                        	elseif (x <= 1.0)
                        		tmp = x;
                        	else
                        		tmp = 1.0;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        code[x_, y_] := If[LessEqual[x, -1.0], 1.0, If[LessEqual[x, 1.0], x, 1.0]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;x \leq -1:\\
                        \;\;\;\;1\\
                        
                        \mathbf{elif}\;x \leq 1:\\
                        \;\;\;\;x\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;1\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if x < -1 or 1 < x

                          1. Initial program 74.2%

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

                              \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
                            2. *-lowering-*.f64N/A

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

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

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

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

                              \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                          3. Simplified99.9%

                            \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
                          4. Add Preprocessing
                          5. Taylor expanded in y around inf

                            \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{1}{1 + x}\right)}\right) \]
                          6. Step-by-step derivation
                            1. /-lowering-/.f64N/A

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

                              \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \left(x + \color{blue}{1}\right)\right)\right) \]
                            3. +-lowering-+.f6427.0%

                              \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                          7. Simplified27.0%

                            \[\leadsto x \cdot \color{blue}{\frac{1}{x + 1}} \]
                          8. Taylor expanded in x around inf

                            \[\leadsto \color{blue}{1} \]
                          9. Step-by-step derivation
                            1. Simplified25.7%

                              \[\leadsto \color{blue}{1} \]

                            if -1 < x < 1

                            1. Initial program 99.9%

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

                                \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
                              2. *-lowering-*.f64N/A

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

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

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

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

                                \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                            3. Simplified99.8%

                              \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
                            4. Add Preprocessing
                            5. Taylor expanded in x around 0

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

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

                            Alternative 11: 14.6% accurate, 11.0× speedup?

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

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

                                \[\leadsto x \cdot \color{blue}{\frac{\frac{x}{y} + 1}{x + 1}} \]
                              2. *-lowering-*.f64N/A

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

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

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

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

                                \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(x, y\right), 1\right), \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                            3. Simplified99.9%

                              \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
                            4. Add Preprocessing
                            5. Taylor expanded in y around inf

                              \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{1}{1 + x}\right)}\right) \]
                            6. Step-by-step derivation
                              1. /-lowering-/.f64N/A

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

                                \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \left(x + \color{blue}{1}\right)\right)\right) \]
                              3. +-lowering-+.f6450.3%

                                \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, \color{blue}{1}\right)\right)\right) \]
                            7. Simplified50.3%

                              \[\leadsto x \cdot \color{blue}{\frac{1}{x + 1}} \]
                            8. Taylor expanded in x around inf

                              \[\leadsto \color{blue}{1} \]
                            9. Step-by-step derivation
                              1. Simplified14.5%

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

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

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

                              Reproduce

                              ?
                              herbie shell --seed 2024158 
                              (FPCore (x y)
                                :name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
                                :precision binary64
                              
                                :alt
                                (! :herbie-platform default (* (/ x 1) (/ (+ (/ x y) 1) (+ x 1))))
                              
                                (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))