Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1

Percentage Accurate: 88.5% → 99.9%
Time: 9.1s
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.5% 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.9% accurate, 1.0× speedup?

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

\\
\frac{x}{\frac{x + 1}{1 + \frac{x}{y}}}
\end{array}
Derivation
  1. Initial program 87.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. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{x}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
  7. Final simplification99.9%

    \[\leadsto \frac{x}{\frac{x + 1}{1 + \frac{x}{y}}} \]
  8. Add Preprocessing

Alternative 2: 85.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + \frac{x}{y}\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -3.1 \cdot 10^{-63}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 0.0003:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ 1.0 (/ x y))))
   (if (<= x -1.0)
     t_0
     (if (<= x -3.1e-63) (* x (/ x y)) (if (<= x 0.0003) x t_0)))))
double code(double x, double y) {
	double t_0 = 1.0 + (x / y);
	double tmp;
	if (x <= -1.0) {
		tmp = t_0;
	} else if (x <= -3.1e-63) {
		tmp = x * (x / y);
	} else if (x <= 0.0003) {
		tmp = 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 = 1.0d0 + (x / y)
    if (x <= (-1.0d0)) then
        tmp = t_0
    else if (x <= (-3.1d-63)) then
        tmp = x * (x / y)
    else if (x <= 0.0003d0) then
        tmp = x
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 1.0 + (x / y);
	double tmp;
	if (x <= -1.0) {
		tmp = t_0;
	} else if (x <= -3.1e-63) {
		tmp = x * (x / y);
	} else if (x <= 0.0003) {
		tmp = x;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = 1.0 + (x / y)
	tmp = 0
	if x <= -1.0:
		tmp = t_0
	elif x <= -3.1e-63:
		tmp = x * (x / y)
	elif x <= 0.0003:
		tmp = x
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(1.0 + Float64(x / y))
	tmp = 0.0
	if (x <= -1.0)
		tmp = t_0;
	elseif (x <= -3.1e-63)
		tmp = Float64(x * Float64(x / y));
	elseif (x <= 0.0003)
		tmp = x;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 1.0 + (x / y);
	tmp = 0.0;
	if (x <= -1.0)
		tmp = t_0;
	elseif (x <= -3.1e-63)
		tmp = x * (x / y);
	elseif (x <= 0.0003)
		tmp = x;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, -3.1e-63], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.0003], x, t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -3.1 \cdot 10^{-63}:\\
\;\;\;\;x \cdot \frac{x}{y}\\

\mathbf{elif}\;x \leq 0.0003:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1 or 2.99999999999999974e-4 < x

    1. Initial program 76.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.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 inf

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

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

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

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

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

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

        \[\leadsto \left(1 + \frac{x}{y}\right) + x \cdot \left(\mathsf{neg}\left(\frac{1}{x \cdot y}\right)\right) \]
      7. +-commutativeN/A

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

        \[\leadsto \frac{x}{y} + \color{blue}{\left(1 + x \cdot \left(\mathsf{neg}\left(\frac{1}{x \cdot y}\right)\right)\right)} \]
      9. distribute-rgt-neg-outN/A

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

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

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

        \[\leadsto \frac{x}{y} + \left(1 + \left(\mathsf{neg}\left(\frac{1}{y}\right)\right)\right) \]
      13. +-commutativeN/A

        \[\leadsto \frac{x}{y} + \left(\left(\mathsf{neg}\left(\frac{1}{y}\right)\right) + \color{blue}{1}\right) \]
      14. neg-sub0N/A

        \[\leadsto \frac{x}{y} + \left(\left(0 - \frac{1}{y}\right) + 1\right) \]
      15. associate-+l-N/A

        \[\leadsto \frac{x}{y} + \left(0 - \color{blue}{\left(\frac{1}{y} - 1\right)}\right) \]
      16. neg-sub0N/A

        \[\leadsto \frac{x}{y} + \left(\mathsf{neg}\left(\left(\frac{1}{y} - 1\right)\right)\right) \]
      17. mul-1-negN/A

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

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(-1 \cdot \left(\frac{1}{y} - 1\right)\right)}\right) \]
    7. Simplified97.2%

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

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

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

      if -1 < x < -3.09999999999999984e-63

      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

          \[\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-/.f6459.2%

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

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

        if -3.09999999999999984e-63 < x < 2.99999999999999974e-4

        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 x around 0

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;1 + \frac{x}{y}\\ \mathbf{elif}\;x \leq -3.1 \cdot 10^{-63}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 0.0003:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{x}{y}\\ \end{array} \]
        9. Add Preprocessing

        Alternative 3: 98.1% accurate, 0.6× speedup?

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

          1. Initial program 76.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.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 inf

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

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

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

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

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

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

              \[\leadsto \left(1 + \frac{x}{y}\right) + x \cdot \left(\mathsf{neg}\left(\frac{1}{x \cdot y}\right)\right) \]
            7. +-commutativeN/A

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

              \[\leadsto \frac{x}{y} + \color{blue}{\left(1 + x \cdot \left(\mathsf{neg}\left(\frac{1}{x \cdot y}\right)\right)\right)} \]
            9. distribute-rgt-neg-outN/A

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

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

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

              \[\leadsto \frac{x}{y} + \left(1 + \left(\mathsf{neg}\left(\frac{1}{y}\right)\right)\right) \]
            13. +-commutativeN/A

              \[\leadsto \frac{x}{y} + \left(\left(\mathsf{neg}\left(\frac{1}{y}\right)\right) + \color{blue}{1}\right) \]
            14. neg-sub0N/A

              \[\leadsto \frac{x}{y} + \left(\left(0 - \frac{1}{y}\right) + 1\right) \]
            15. associate-+l-N/A

              \[\leadsto \frac{x}{y} + \left(0 - \color{blue}{\left(\frac{1}{y} - 1\right)}\right) \]
            16. neg-sub0N/A

              \[\leadsto \frac{x}{y} + \left(\mathsf{neg}\left(\left(\frac{1}{y} - 1\right)\right)\right) \]
            17. mul-1-negN/A

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

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(-1 \cdot \left(\frac{1}{y} - 1\right)\right)}\right) \]
          7. Simplified97.2%

            \[\leadsto \color{blue}{\frac{x}{y} + \left(1 - \frac{1}{y}\right)} \]

          if -1 < x < 1.26000000000000001

          1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 4: 72.7% accurate, 0.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq -4.3 \cdot 10^{-66}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 0.0145:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
          (FPCore (x y)
           :precision binary64
           (if (<= x -1.0)
             (/ x y)
             (if (<= x -4.3e-66) (* x (/ x y)) (if (<= x 0.0145) x (/ x y)))))
          double code(double x, double y) {
          	double tmp;
          	if (x <= -1.0) {
          		tmp = x / y;
          	} else if (x <= -4.3e-66) {
          		tmp = x * (x / y);
          	} else if (x <= 0.0145) {
          		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 <= (-4.3d-66)) then
                  tmp = x * (x / y)
              else if (x <= 0.0145d0) 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 <= -4.3e-66) {
          		tmp = x * (x / y);
          	} else if (x <= 0.0145) {
          		tmp = x;
          	} else {
          		tmp = x / y;
          	}
          	return tmp;
          }
          
          def code(x, y):
          	tmp = 0
          	if x <= -1.0:
          		tmp = x / y
          	elif x <= -4.3e-66:
          		tmp = x * (x / y)
          	elif x <= 0.0145:
          		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 <= -4.3e-66)
          		tmp = Float64(x * Float64(x / y));
          	elseif (x <= 0.0145)
          		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 <= -4.3e-66)
          		tmp = x * (x / y);
          	elseif (x <= 0.0145)
          		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, -4.3e-66], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.0145], x, N[(x / y), $MachinePrecision]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;x \leq -1:\\
          \;\;\;\;\frac{x}{y}\\
          
          \mathbf{elif}\;x \leq -4.3 \cdot 10^{-66}:\\
          \;\;\;\;x \cdot \frac{x}{y}\\
          
          \mathbf{elif}\;x \leq 0.0145:\\
          \;\;\;\;x\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{x}{y}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if x < -1 or 0.0145000000000000007 < x

            1. Initial program 76.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.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 inf

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

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

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

            if -1 < x < -4.30000000000000013e-66

            1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

                \[\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-/.f6459.2%

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

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

              if -4.30000000000000013e-66 < x < 0.0145000000000000007

              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 x around 0

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

                  \[\leadsto \color{blue}{x} \]
              7. Recombined 3 regimes into one program.
              8. Final simplification75.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq -4.3 \cdot 10^{-66}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 0.0145:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
              9. Add Preprocessing

              Alternative 5: 97.9% accurate, 0.6× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + \frac{x}{y}\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              (FPCore (x y)
               :precision binary64
               (let* ((t_0 (+ 1.0 (/ x y))))
                 (if (<= x -1.0) t_0 (if (<= x 1.0) (* x t_0) t_0))))
              double code(double x, double y) {
              	double t_0 = 1.0 + (x / y);
              	double tmp;
              	if (x <= -1.0) {
              		tmp = t_0;
              	} else if (x <= 1.0) {
              		tmp = x * t_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 = 1.0d0 + (x / y)
                  if (x <= (-1.0d0)) then
                      tmp = t_0
                  else if (x <= 1.0d0) then
                      tmp = x * t_0
                  else
                      tmp = t_0
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y) {
              	double t_0 = 1.0 + (x / y);
              	double tmp;
              	if (x <= -1.0) {
              		tmp = t_0;
              	} else if (x <= 1.0) {
              		tmp = x * t_0;
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              def code(x, y):
              	t_0 = 1.0 + (x / y)
              	tmp = 0
              	if x <= -1.0:
              		tmp = t_0
              	elif x <= 1.0:
              		tmp = x * t_0
              	else:
              		tmp = t_0
              	return tmp
              
              function code(x, y)
              	t_0 = Float64(1.0 + Float64(x / y))
              	tmp = 0.0
              	if (x <= -1.0)
              		tmp = t_0;
              	elseif (x <= 1.0)
              		tmp = Float64(x * t_0);
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y)
              	t_0 = 1.0 + (x / y);
              	tmp = 0.0;
              	if (x <= -1.0)
              		tmp = t_0;
              	elseif (x <= 1.0)
              		tmp = x * t_0;
              	else
              		tmp = t_0;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 1.0], N[(x * t$95$0), $MachinePrecision], t$95$0]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := 1 + \frac{x}{y}\\
              \mathbf{if}\;x \leq -1:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;x \leq 1:\\
              \;\;\;\;x \cdot t\_0\\
              
              \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 76.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.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 inf

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

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

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

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

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

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

                    \[\leadsto \left(1 + \frac{x}{y}\right) + x \cdot \left(\mathsf{neg}\left(\frac{1}{x \cdot y}\right)\right) \]
                  7. +-commutativeN/A

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

                    \[\leadsto \frac{x}{y} + \color{blue}{\left(1 + x \cdot \left(\mathsf{neg}\left(\frac{1}{x \cdot y}\right)\right)\right)} \]
                  9. distribute-rgt-neg-outN/A

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

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

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

                    \[\leadsto \frac{x}{y} + \left(1 + \left(\mathsf{neg}\left(\frac{1}{y}\right)\right)\right) \]
                  13. +-commutativeN/A

                    \[\leadsto \frac{x}{y} + \left(\left(\mathsf{neg}\left(\frac{1}{y}\right)\right) + \color{blue}{1}\right) \]
                  14. neg-sub0N/A

                    \[\leadsto \frac{x}{y} + \left(\left(0 - \frac{1}{y}\right) + 1\right) \]
                  15. associate-+l-N/A

                    \[\leadsto \frac{x}{y} + \left(0 - \color{blue}{\left(\frac{1}{y} - 1\right)}\right) \]
                  16. neg-sub0N/A

                    \[\leadsto \frac{x}{y} + \left(\mathsf{neg}\left(\left(\frac{1}{y} - 1\right)\right)\right) \]
                  17. mul-1-negN/A

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

                    \[\leadsto \mathsf{+.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(-1 \cdot \left(\frac{1}{y} - 1\right)\right)}\right) \]
                7. Simplified97.2%

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

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

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

                  if -1 < x < 1

                  1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 6: 86.3% accurate, 0.6× speedup?

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

                    1. Initial program 76.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.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 inf

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

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

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

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

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

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

                        \[\leadsto \left(1 + \frac{x}{y}\right) + x \cdot \left(\mathsf{neg}\left(\frac{1}{x \cdot y}\right)\right) \]
                      7. +-commutativeN/A

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

                        \[\leadsto \frac{x}{y} + \color{blue}{\left(1 + x \cdot \left(\mathsf{neg}\left(\frac{1}{x \cdot y}\right)\right)\right)} \]
                      9. distribute-rgt-neg-outN/A

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

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

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

                        \[\leadsto \frac{x}{y} + \left(1 + \left(\mathsf{neg}\left(\frac{1}{y}\right)\right)\right) \]
                      13. +-commutativeN/A

                        \[\leadsto \frac{x}{y} + \left(\left(\mathsf{neg}\left(\frac{1}{y}\right)\right) + \color{blue}{1}\right) \]
                      14. neg-sub0N/A

                        \[\leadsto \frac{x}{y} + \left(\left(0 - \frac{1}{y}\right) + 1\right) \]
                      15. associate-+l-N/A

                        \[\leadsto \frac{x}{y} + \left(0 - \color{blue}{\left(\frac{1}{y} - 1\right)}\right) \]
                      16. neg-sub0N/A

                        \[\leadsto \frac{x}{y} + \left(\mathsf{neg}\left(\left(\frac{1}{y} - 1\right)\right)\right) \]
                      17. mul-1-negN/A

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

                        \[\leadsto \mathsf{+.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(-1 \cdot \left(\frac{1}{y} - 1\right)\right)}\right) \]
                    7. Simplified98.6%

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

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

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

                      if -31 < x < 12000

                      1. Initial program 99.8%

                        \[\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-+.f6476.0%

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

                        \[\leadsto x \cdot \color{blue}{\frac{1}{x + 1}} \]
                    10. Recombined 2 regimes into one program.
                    11. Final simplification87.0%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -31:\\ \;\;\;\;1 + \frac{x}{y}\\ \mathbf{elif}\;x \leq 12000:\\ \;\;\;\;x \cdot \frac{1}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{x}{y}\\ \end{array} \]
                    12. Add Preprocessing

                    Alternative 7: 86.3% accurate, 0.7× speedup?

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

                      1. Initial program 76.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.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 inf

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

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

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

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

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

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

                          \[\leadsto \left(1 + \frac{x}{y}\right) + x \cdot \left(\mathsf{neg}\left(\frac{1}{x \cdot y}\right)\right) \]
                        7. +-commutativeN/A

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

                          \[\leadsto \frac{x}{y} + \color{blue}{\left(1 + x \cdot \left(\mathsf{neg}\left(\frac{1}{x \cdot y}\right)\right)\right)} \]
                        9. distribute-rgt-neg-outN/A

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

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

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

                          \[\leadsto \frac{x}{y} + \left(1 + \left(\mathsf{neg}\left(\frac{1}{y}\right)\right)\right) \]
                        13. +-commutativeN/A

                          \[\leadsto \frac{x}{y} + \left(\left(\mathsf{neg}\left(\frac{1}{y}\right)\right) + \color{blue}{1}\right) \]
                        14. neg-sub0N/A

                          \[\leadsto \frac{x}{y} + \left(\left(0 - \frac{1}{y}\right) + 1\right) \]
                        15. associate-+l-N/A

                          \[\leadsto \frac{x}{y} + \left(0 - \color{blue}{\left(\frac{1}{y} - 1\right)}\right) \]
                        16. neg-sub0N/A

                          \[\leadsto \frac{x}{y} + \left(\mathsf{neg}\left(\left(\frac{1}{y} - 1\right)\right)\right) \]
                        17. mul-1-negN/A

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

                          \[\leadsto \mathsf{+.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(-1 \cdot \left(\frac{1}{y} - 1\right)\right)}\right) \]
                      7. Simplified98.6%

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

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

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

                        if -31 < x < 11000

                        1. Initial program 99.8%

                          \[\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-+.f6475.9%

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

                          \[\leadsto \color{blue}{\frac{x}{x + 1}} \]
                      10. Recombined 2 regimes into one program.
                      11. Final simplification87.0%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -31:\\ \;\;\;\;1 + \frac{x}{y}\\ \mathbf{elif}\;x \leq 11000:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{x}{y}\\ \end{array} \]
                      12. Add Preprocessing

                      Alternative 8: 73.4% accurate, 0.8× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 0.38:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
                      (FPCore (x y)
                       :precision binary64
                       (if (<= x -1.0) (/ x y) (if (<= x 0.38) x (/ x y))))
                      double code(double x, double y) {
                      	double tmp;
                      	if (x <= -1.0) {
                      		tmp = x / y;
                      	} else if (x <= 0.38) {
                      		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 <= 0.38d0) 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 <= 0.38) {
                      		tmp = x;
                      	} else {
                      		tmp = x / y;
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y):
                      	tmp = 0
                      	if x <= -1.0:
                      		tmp = x / y
                      	elif x <= 0.38:
                      		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 <= 0.38)
                      		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 <= 0.38)
                      		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, 0.38], x, N[(x / y), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;x \leq -1:\\
                      \;\;\;\;\frac{x}{y}\\
                      
                      \mathbf{elif}\;x \leq 0.38:\\
                      \;\;\;\;x\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{x}{y}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if x < -1 or 0.38 < x

                        1. Initial program 76.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.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 inf

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

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

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

                        if -1 < x < 0.38

                        1. Initial program 99.8%

                          \[\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. Simplified74.9%

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

                        Alternative 9: 50.1% accurate, 1.0× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -205000000:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
                        (FPCore (x y)
                         :precision binary64
                         (if (<= x -205000000.0) 1.0 (if (<= x 1.0) x 1.0)))
                        double code(double x, double y) {
                        	double tmp;
                        	if (x <= -205000000.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 <= (-205000000.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 <= -205000000.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 <= -205000000.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 <= -205000000.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 <= -205000000.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, -205000000.0], 1.0, If[LessEqual[x, 1.0], x, 1.0]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;x \leq -205000000:\\
                        \;\;\;\;1\\
                        
                        \mathbf{elif}\;x \leq 1:\\
                        \;\;\;\;x\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;1\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if x < -2.05e8 or 1 < x

                          1. Initial program 76.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.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-+.f6428.8%

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

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

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

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

                            if -2.05e8 < x < 1

                            1. Initial program 99.8%

                              \[\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 0

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

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

                            Alternative 10: 99.8% accurate, 1.0× speedup?

                            \[\begin{array}{l} \\ x \cdot \frac{1 + \frac{x}{y}}{x + 1} \end{array} \]
                            (FPCore (x y) :precision binary64 (* x (/ (+ 1.0 (/ x y)) (+ x 1.0))))
                            double code(double x, double y) {
                            	return x * ((1.0 + (x / y)) / (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)) / (x + 1.0d0))
                            end function
                            
                            public static double code(double x, double y) {
                            	return x * ((1.0 + (x / y)) / (x + 1.0));
                            }
                            
                            def code(x, y):
                            	return x * ((1.0 + (x / y)) / (x + 1.0))
                            
                            function code(x, y)
                            	return Float64(x * Float64(Float64(1.0 + Float64(x / y)) / Float64(x + 1.0)))
                            end
                            
                            function tmp = code(x, y)
                            	tmp = x * ((1.0 + (x / y)) / (x + 1.0));
                            end
                            
                            code[x_, y_] := N[(x * N[(N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                            
                            \begin{array}{l}
                            
                            \\
                            x \cdot \frac{1 + \frac{x}{y}}{x + 1}
                            \end{array}
                            
                            Derivation
                            1. Initial program 87.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. Final simplification99.8%

                              \[\leadsto x \cdot \frac{1 + \frac{x}{y}}{x + 1} \]
                            6. Add Preprocessing

                            Alternative 11: 14.7% 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.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-+.f6452.0%

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

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

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

                                \[\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 2024161 
                              (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)))