Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1

Percentage Accurate: 88.4% → 99.9%
Time: 10.6s
Alternatives: 14
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 14 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.4% 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 86.9%

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. clear-num99.8%

      \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
    2. un-div-inv99.9%

      \[\leadsto \color{blue}{\frac{x}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
  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: 72.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{x}{y}\\ \mathbf{if}\;x \leq -58000000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-71}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-178}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-159}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-110}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-89}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 0.36:\\ \;\;\;\;x \cdot \left(1 - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* x (/ x y))))
   (if (<= x -58000000000.0)
     (/ x y)
     (if (<= x -2.2e-71)
       t_0
       (if (<= x 2.25e-178)
         x
         (if (<= x 1.6e-159)
           t_0
           (if (<= x 1.6e-110)
             x
             (if (<= x 8.5e-89)
               t_0
               (if (<= x 0.36) (* x (- 1.0 x)) (/ x y))))))))))
double code(double x, double y) {
	double t_0 = x * (x / y);
	double tmp;
	if (x <= -58000000000.0) {
		tmp = x / y;
	} else if (x <= -2.2e-71) {
		tmp = t_0;
	} else if (x <= 2.25e-178) {
		tmp = x;
	} else if (x <= 1.6e-159) {
		tmp = t_0;
	} else if (x <= 1.6e-110) {
		tmp = x;
	} else if (x <= 8.5e-89) {
		tmp = t_0;
	} else if (x <= 0.36) {
		tmp = x * (1.0 - x);
	} else {
		tmp = x / y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * (x / y)
    if (x <= (-58000000000.0d0)) then
        tmp = x / y
    else if (x <= (-2.2d-71)) then
        tmp = t_0
    else if (x <= 2.25d-178) then
        tmp = x
    else if (x <= 1.6d-159) then
        tmp = t_0
    else if (x <= 1.6d-110) then
        tmp = x
    else if (x <= 8.5d-89) then
        tmp = t_0
    else if (x <= 0.36d0) then
        tmp = x * (1.0d0 - x)
    else
        tmp = x / y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x * (x / y);
	double tmp;
	if (x <= -58000000000.0) {
		tmp = x / y;
	} else if (x <= -2.2e-71) {
		tmp = t_0;
	} else if (x <= 2.25e-178) {
		tmp = x;
	} else if (x <= 1.6e-159) {
		tmp = t_0;
	} else if (x <= 1.6e-110) {
		tmp = x;
	} else if (x <= 8.5e-89) {
		tmp = t_0;
	} else if (x <= 0.36) {
		tmp = x * (1.0 - x);
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y):
	t_0 = x * (x / y)
	tmp = 0
	if x <= -58000000000.0:
		tmp = x / y
	elif x <= -2.2e-71:
		tmp = t_0
	elif x <= 2.25e-178:
		tmp = x
	elif x <= 1.6e-159:
		tmp = t_0
	elif x <= 1.6e-110:
		tmp = x
	elif x <= 8.5e-89:
		tmp = t_0
	elif x <= 0.36:
		tmp = x * (1.0 - x)
	else:
		tmp = x / y
	return tmp
function code(x, y)
	t_0 = Float64(x * Float64(x / y))
	tmp = 0.0
	if (x <= -58000000000.0)
		tmp = Float64(x / y);
	elseif (x <= -2.2e-71)
		tmp = t_0;
	elseif (x <= 2.25e-178)
		tmp = x;
	elseif (x <= 1.6e-159)
		tmp = t_0;
	elseif (x <= 1.6e-110)
		tmp = x;
	elseif (x <= 8.5e-89)
		tmp = t_0;
	elseif (x <= 0.36)
		tmp = Float64(x * Float64(1.0 - x));
	else
		tmp = Float64(x / y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = x * (x / y);
	tmp = 0.0;
	if (x <= -58000000000.0)
		tmp = x / y;
	elseif (x <= -2.2e-71)
		tmp = t_0;
	elseif (x <= 2.25e-178)
		tmp = x;
	elseif (x <= 1.6e-159)
		tmp = t_0;
	elseif (x <= 1.6e-110)
		tmp = x;
	elseif (x <= 8.5e-89)
		tmp = t_0;
	elseif (x <= 0.36)
		tmp = x * (1.0 - x);
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -58000000000.0], N[(x / y), $MachinePrecision], If[LessEqual[x, -2.2e-71], t$95$0, If[LessEqual[x, 2.25e-178], x, If[LessEqual[x, 1.6e-159], t$95$0, If[LessEqual[x, 1.6e-110], x, If[LessEqual[x, 8.5e-89], t$95$0, If[LessEqual[x, 0.36], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -58000000000:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;x \leq -2.2 \cdot 10^{-71}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 2.25 \cdot 10^{-178}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1.6 \cdot 10^{-159}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.6 \cdot 10^{-110}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 8.5 \cdot 10^{-89}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 0.36:\\
\;\;\;\;x \cdot \left(1 - x\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -5.8e10 or 0.35999999999999999 < x

    1. Initial program 75.6%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

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

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

    if -5.8e10 < x < -2.19999999999999997e-71 or 2.24999999999999989e-178 < x < 1.6e-159 or 1.60000000000000014e-110 < x < 8.49999999999999937e-89

    1. Initial program 99.7%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.5%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
      2. un-div-inv99.6%

        \[\leadsto \color{blue}{\frac{x}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
    6. Applied egg-rr99.6%

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

      \[\leadsto \frac{x}{\color{blue}{\frac{y \cdot \left(1 + x\right)}{x}}} \]
    8. Step-by-step derivation
      1. associate-/l*68.5%

        \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    9. Simplified68.5%

      \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    10. Taylor expanded in x around 0 67.8%

      \[\leadsto \frac{x}{y \cdot \color{blue}{\frac{1}{x}}} \]
    11. Step-by-step derivation
      1. un-div-inv67.9%

        \[\leadsto \frac{x}{\color{blue}{\frac{y}{x}}} \]
      2. associate-/r/67.8%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot x} \]
    12. Applied egg-rr67.8%

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

    if -2.19999999999999997e-71 < x < 2.24999999999999989e-178 or 1.6e-159 < x < 1.60000000000000014e-110

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified100.0%

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

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

    if 8.49999999999999937e-89 < x < 0.35999999999999999

    1. Initial program 99.7%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.7%

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot x\right)} \]
    7. Step-by-step derivation
      1. neg-mul-184.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-x\right)}\right) \]
      2. sub-neg84.2%

        \[\leadsto x \cdot \color{blue}{\left(1 - x\right)} \]
    8. Simplified84.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -58000000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-71}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-178}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-159}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-110}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-89}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 0.36:\\ \;\;\;\;x \cdot \left(1 - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 73.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -8.6 \cdot 10^{+41}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-178}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-159}:\\ \;\;\;\;\frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-115}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-88}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 0.76:\\ \;\;\;\;x \cdot \left(1 - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -8.6e+41)
   (/ x y)
   (if (<= x 2.25e-178)
     (/ x (+ x 1.0))
     (if (<= x 1.6e-159)
       (/ x (/ y x))
       (if (<= x 2.8e-115)
         x
         (if (<= x 5.6e-88)
           (* x (/ x y))
           (if (<= x 0.76) (* x (- 1.0 x)) (/ x y))))))))
double code(double x, double y) {
	double tmp;
	if (x <= -8.6e+41) {
		tmp = x / y;
	} else if (x <= 2.25e-178) {
		tmp = x / (x + 1.0);
	} else if (x <= 1.6e-159) {
		tmp = x / (y / x);
	} else if (x <= 2.8e-115) {
		tmp = x;
	} else if (x <= 5.6e-88) {
		tmp = x * (x / y);
	} else if (x <= 0.76) {
		tmp = x * (1.0 - x);
	} else {
		tmp = x / y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-8.6d+41)) then
        tmp = x / y
    else if (x <= 2.25d-178) then
        tmp = x / (x + 1.0d0)
    else if (x <= 1.6d-159) then
        tmp = x / (y / x)
    else if (x <= 2.8d-115) then
        tmp = x
    else if (x <= 5.6d-88) then
        tmp = x * (x / y)
    else if (x <= 0.76d0) then
        tmp = x * (1.0d0 - x)
    else
        tmp = x / y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -8.6e+41) {
		tmp = x / y;
	} else if (x <= 2.25e-178) {
		tmp = x / (x + 1.0);
	} else if (x <= 1.6e-159) {
		tmp = x / (y / x);
	} else if (x <= 2.8e-115) {
		tmp = x;
	} else if (x <= 5.6e-88) {
		tmp = x * (x / y);
	} else if (x <= 0.76) {
		tmp = x * (1.0 - x);
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -8.6e+41:
		tmp = x / y
	elif x <= 2.25e-178:
		tmp = x / (x + 1.0)
	elif x <= 1.6e-159:
		tmp = x / (y / x)
	elif x <= 2.8e-115:
		tmp = x
	elif x <= 5.6e-88:
		tmp = x * (x / y)
	elif x <= 0.76:
		tmp = x * (1.0 - x)
	else:
		tmp = x / y
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -8.6e+41)
		tmp = Float64(x / y);
	elseif (x <= 2.25e-178)
		tmp = Float64(x / Float64(x + 1.0));
	elseif (x <= 1.6e-159)
		tmp = Float64(x / Float64(y / x));
	elseif (x <= 2.8e-115)
		tmp = x;
	elseif (x <= 5.6e-88)
		tmp = Float64(x * Float64(x / y));
	elseif (x <= 0.76)
		tmp = Float64(x * Float64(1.0 - x));
	else
		tmp = Float64(x / y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -8.6e+41)
		tmp = x / y;
	elseif (x <= 2.25e-178)
		tmp = x / (x + 1.0);
	elseif (x <= 1.6e-159)
		tmp = x / (y / x);
	elseif (x <= 2.8e-115)
		tmp = x;
	elseif (x <= 5.6e-88)
		tmp = x * (x / y);
	elseif (x <= 0.76)
		tmp = x * (1.0 - x);
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -8.6e+41], N[(x / y), $MachinePrecision], If[LessEqual[x, 2.25e-178], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.6e-159], N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e-115], x, If[LessEqual[x, 5.6e-88], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.76], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.6 \cdot 10^{+41}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;x \leq 2.25 \cdot 10^{-178}:\\
\;\;\;\;\frac{x}{x + 1}\\

\mathbf{elif}\;x \leq 1.6 \cdot 10^{-159}:\\
\;\;\;\;\frac{x}{\frac{y}{x}}\\

\mathbf{elif}\;x \leq 2.8 \cdot 10^{-115}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 5.6 \cdot 10^{-88}:\\
\;\;\;\;x \cdot \frac{x}{y}\\

\mathbf{elif}\;x \leq 0.76:\\
\;\;\;\;x \cdot \left(1 - x\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if x < -8.60000000000000048e41 or 0.76000000000000001 < x

    1. Initial program 74.1%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

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

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

    if -8.60000000000000048e41 < x < 2.24999999999999989e-178

    1. Initial program 98.9%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

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

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

    if 2.24999999999999989e-178 < x < 1.6e-159

    1. Initial program 99.3%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.3%

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.3%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
      2. un-div-inv99.6%

        \[\leadsto \color{blue}{\frac{x}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
    6. Applied egg-rr99.6%

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

      \[\leadsto \frac{x}{\color{blue}{\frac{y \cdot \left(1 + x\right)}{x}}} \]
    8. Step-by-step derivation
      1. associate-/l*86.2%

        \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    9. Simplified86.2%

      \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    10. Taylor expanded in x around 0 86.2%

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

    if 1.6e-159 < x < 2.79999999999999987e-115

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified100.0%

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

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

    if 2.79999999999999987e-115 < x < 5.59999999999999952e-88

    1. Initial program 99.8%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    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-num99.6%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
      2. un-div-inv99.6%

        \[\leadsto \color{blue}{\frac{x}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
    6. Applied egg-rr99.6%

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

      \[\leadsto \frac{x}{\color{blue}{\frac{y \cdot \left(1 + x\right)}{x}}} \]
    8. Step-by-step derivation
      1. associate-/l*74.3%

        \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    9. Simplified74.3%

      \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    10. Taylor expanded in x around 0 74.3%

      \[\leadsto \frac{x}{y \cdot \color{blue}{\frac{1}{x}}} \]
    11. Step-by-step derivation
      1. un-div-inv74.3%

        \[\leadsto \frac{x}{\color{blue}{\frac{y}{x}}} \]
      2. associate-/r/74.3%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot x} \]
    12. Applied egg-rr74.3%

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

    if 5.59999999999999952e-88 < x < 0.76000000000000001

    1. Initial program 99.7%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.7%

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot x\right)} \]
    7. Step-by-step derivation
      1. neg-mul-184.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-x\right)}\right) \]
      2. sub-neg84.2%

        \[\leadsto x \cdot \color{blue}{\left(1 - x\right)} \]
    8. Simplified84.2%

      \[\leadsto \color{blue}{x \cdot \left(1 - x\right)} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification80.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.6 \cdot 10^{+41}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-178}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-159}:\\ \;\;\;\;\frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-115}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-88}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 0.76:\\ \;\;\;\;x \cdot \left(1 - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 73.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{x}{y}\\ \mathbf{if}\;x \leq -8.6 \cdot 10^{+41}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-178}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-159}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-110}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 9.6 \cdot 10^{-89}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 0.76:\\ \;\;\;\;x \cdot \left(1 - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* x (/ x y))))
   (if (<= x -8.6e+41)
     (/ x y)
     (if (<= x 2.25e-178)
       (/ x (+ x 1.0))
       (if (<= x 1.6e-159)
         t_0
         (if (<= x 1.65e-110)
           x
           (if (<= x 9.6e-89)
             t_0
             (if (<= x 0.76) (* x (- 1.0 x)) (/ x y)))))))))
double code(double x, double y) {
	double t_0 = x * (x / y);
	double tmp;
	if (x <= -8.6e+41) {
		tmp = x / y;
	} else if (x <= 2.25e-178) {
		tmp = x / (x + 1.0);
	} else if (x <= 1.6e-159) {
		tmp = t_0;
	} else if (x <= 1.65e-110) {
		tmp = x;
	} else if (x <= 9.6e-89) {
		tmp = t_0;
	} else if (x <= 0.76) {
		tmp = x * (1.0 - x);
	} else {
		tmp = x / y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * (x / y)
    if (x <= (-8.6d+41)) then
        tmp = x / y
    else if (x <= 2.25d-178) then
        tmp = x / (x + 1.0d0)
    else if (x <= 1.6d-159) then
        tmp = t_0
    else if (x <= 1.65d-110) then
        tmp = x
    else if (x <= 9.6d-89) then
        tmp = t_0
    else if (x <= 0.76d0) then
        tmp = x * (1.0d0 - x)
    else
        tmp = x / y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x * (x / y);
	double tmp;
	if (x <= -8.6e+41) {
		tmp = x / y;
	} else if (x <= 2.25e-178) {
		tmp = x / (x + 1.0);
	} else if (x <= 1.6e-159) {
		tmp = t_0;
	} else if (x <= 1.65e-110) {
		tmp = x;
	} else if (x <= 9.6e-89) {
		tmp = t_0;
	} else if (x <= 0.76) {
		tmp = x * (1.0 - x);
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y):
	t_0 = x * (x / y)
	tmp = 0
	if x <= -8.6e+41:
		tmp = x / y
	elif x <= 2.25e-178:
		tmp = x / (x + 1.0)
	elif x <= 1.6e-159:
		tmp = t_0
	elif x <= 1.65e-110:
		tmp = x
	elif x <= 9.6e-89:
		tmp = t_0
	elif x <= 0.76:
		tmp = x * (1.0 - x)
	else:
		tmp = x / y
	return tmp
function code(x, y)
	t_0 = Float64(x * Float64(x / y))
	tmp = 0.0
	if (x <= -8.6e+41)
		tmp = Float64(x / y);
	elseif (x <= 2.25e-178)
		tmp = Float64(x / Float64(x + 1.0));
	elseif (x <= 1.6e-159)
		tmp = t_0;
	elseif (x <= 1.65e-110)
		tmp = x;
	elseif (x <= 9.6e-89)
		tmp = t_0;
	elseif (x <= 0.76)
		tmp = Float64(x * Float64(1.0 - x));
	else
		tmp = Float64(x / y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = x * (x / y);
	tmp = 0.0;
	if (x <= -8.6e+41)
		tmp = x / y;
	elseif (x <= 2.25e-178)
		tmp = x / (x + 1.0);
	elseif (x <= 1.6e-159)
		tmp = t_0;
	elseif (x <= 1.65e-110)
		tmp = x;
	elseif (x <= 9.6e-89)
		tmp = t_0;
	elseif (x <= 0.76)
		tmp = x * (1.0 - x);
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.6e+41], N[(x / y), $MachinePrecision], If[LessEqual[x, 2.25e-178], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.6e-159], t$95$0, If[LessEqual[x, 1.65e-110], x, If[LessEqual[x, 9.6e-89], t$95$0, If[LessEqual[x, 0.76], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -8.6 \cdot 10^{+41}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;x \leq 2.25 \cdot 10^{-178}:\\
\;\;\;\;\frac{x}{x + 1}\\

\mathbf{elif}\;x \leq 1.6 \cdot 10^{-159}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.65 \cdot 10^{-110}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 9.6 \cdot 10^{-89}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 0.76:\\
\;\;\;\;x \cdot \left(1 - x\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -8.60000000000000048e41 or 0.76000000000000001 < x

    1. Initial program 74.1%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

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

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

    if -8.60000000000000048e41 < x < 2.24999999999999989e-178

    1. Initial program 98.9%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

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

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

    if 2.24999999999999989e-178 < x < 1.6e-159 or 1.65e-110 < x < 9.60000000000000065e-89

    1. Initial program 99.6%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.5%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
      2. un-div-inv99.6%

        \[\leadsto \color{blue}{\frac{x}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
    6. Applied egg-rr99.6%

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

      \[\leadsto \frac{x}{\color{blue}{\frac{y \cdot \left(1 + x\right)}{x}}} \]
    8. Step-by-step derivation
      1. associate-/l*79.8%

        \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    9. Simplified79.8%

      \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    10. Taylor expanded in x around 0 79.8%

      \[\leadsto \frac{x}{y \cdot \color{blue}{\frac{1}{x}}} \]
    11. Step-by-step derivation
      1. un-div-inv79.8%

        \[\leadsto \frac{x}{\color{blue}{\frac{y}{x}}} \]
      2. associate-/r/79.6%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot x} \]
    12. Applied egg-rr79.6%

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

    if 1.6e-159 < x < 1.65e-110

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified100.0%

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

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

    if 9.60000000000000065e-89 < x < 0.76000000000000001

    1. Initial program 99.7%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.7%

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot x\right)} \]
    7. Step-by-step derivation
      1. neg-mul-184.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-x\right)}\right) \]
      2. sub-neg84.2%

        \[\leadsto x \cdot \color{blue}{\left(1 - x\right)} \]
    8. Simplified84.2%

      \[\leadsto \color{blue}{x \cdot \left(1 - x\right)} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification80.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.6 \cdot 10^{+41}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-178}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-159}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-110}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 9.6 \cdot 10^{-89}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 0.76:\\ \;\;\;\;x \cdot \left(1 - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 84.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.6 \cdot 10^{+23}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{-19}:\\ \;\;\;\;x + x \cdot \left(\frac{x}{y} - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + \frac{y}{x}}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -5.6e+23)
   (/ x y)
   (if (<= x 1.95e-19) (+ x (* x (- (/ x y) x))) (/ x (+ y (/ y x))))))
double code(double x, double y) {
	double tmp;
	if (x <= -5.6e+23) {
		tmp = x / y;
	} else if (x <= 1.95e-19) {
		tmp = x + (x * ((x / y) - x));
	} else {
		tmp = x / (y + (y / x));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-5.6d+23)) then
        tmp = x / y
    else if (x <= 1.95d-19) then
        tmp = x + (x * ((x / y) - x))
    else
        tmp = x / (y + (y / x))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -5.6e+23) {
		tmp = x / y;
	} else if (x <= 1.95e-19) {
		tmp = x + (x * ((x / y) - x));
	} else {
		tmp = x / (y + (y / x));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -5.6e+23:
		tmp = x / y
	elif x <= 1.95e-19:
		tmp = x + (x * ((x / y) - x))
	else:
		tmp = x / (y + (y / x))
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -5.6e+23)
		tmp = Float64(x / y);
	elseif (x <= 1.95e-19)
		tmp = Float64(x + Float64(x * Float64(Float64(x / y) - x)));
	else
		tmp = Float64(x / Float64(y + Float64(y / x)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -5.6e+23)
		tmp = x / y;
	elseif (x <= 1.95e-19)
		tmp = x + (x * ((x / y) - x));
	else
		tmp = x / (y + (y / x));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -5.6e+23], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.95e-19], N[(x + N[(x * N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{+23}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;x \leq 1.95 \cdot 10^{-19}:\\
\;\;\;\;x + x \cdot \left(\frac{x}{y} - x\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.6e23

    1. Initial program 74.5%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    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 75.0%

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

    if -5.6e23 < x < 1.94999999999999998e-19

    1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    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 94.8%

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

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot x + \frac{x}{y}\right)}\right) \]
    7. Step-by-step derivation
      1. neg-mul-194.8%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{\left(-x\right)} + \frac{x}{y}\right)\right) \]
      2. +-commutative94.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} + \left(-x\right)\right)}\right) \]
      3. unsub-neg94.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} - x\right)}\right) \]
    8. Simplified94.8%

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} - x\right)}\right) \]
    9. Step-by-step derivation
      1. +-commutative94.8%

        \[\leadsto x \cdot \color{blue}{\left(\left(\frac{x}{y} - x\right) + 1\right)} \]
      2. distribute-rgt-in94.8%

        \[\leadsto \color{blue}{\left(\frac{x}{y} - x\right) \cdot x + 1 \cdot x} \]
      3. *-commutative94.8%

        \[\leadsto \color{blue}{x \cdot \left(\frac{x}{y} - x\right)} + 1 \cdot x \]
      4. *-un-lft-identity94.8%

        \[\leadsto x \cdot \left(\frac{x}{y} - x\right) + \color{blue}{x} \]
    10. Applied egg-rr94.8%

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

    if 1.94999999999999998e-19 < x

    1. Initial program 76.3%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
      2. un-div-inv100.0%

        \[\leadsto \color{blue}{\frac{x}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
    6. Applied egg-rr100.0%

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

      \[\leadsto \frac{x}{\color{blue}{\frac{y \cdot \left(1 + x\right)}{x}}} \]
    8. Step-by-step derivation
      1. associate-/l*80.6%

        \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    9. Simplified80.6%

      \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    10. Taylor expanded in x around inf 80.6%

      \[\leadsto \frac{x}{\color{blue}{y + \frac{y}{x}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.9%

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

Alternative 6: 84.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.6 \cdot 10^{+23}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{-19}:\\ \;\;\;\;x \cdot \left(1 + \left(\frac{x}{y} - x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + \frac{y}{x}}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -5.6e+23)
   (/ x y)
   (if (<= x 1.95e-19) (* x (+ 1.0 (- (/ x y) x))) (/ x (+ y (/ y x))))))
double code(double x, double y) {
	double tmp;
	if (x <= -5.6e+23) {
		tmp = x / y;
	} else if (x <= 1.95e-19) {
		tmp = x * (1.0 + ((x / y) - x));
	} else {
		tmp = x / (y + (y / x));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-5.6d+23)) then
        tmp = x / y
    else if (x <= 1.95d-19) then
        tmp = x * (1.0d0 + ((x / y) - x))
    else
        tmp = x / (y + (y / x))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -5.6e+23) {
		tmp = x / y;
	} else if (x <= 1.95e-19) {
		tmp = x * (1.0 + ((x / y) - x));
	} else {
		tmp = x / (y + (y / x));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -5.6e+23:
		tmp = x / y
	elif x <= 1.95e-19:
		tmp = x * (1.0 + ((x / y) - x))
	else:
		tmp = x / (y + (y / x))
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -5.6e+23)
		tmp = Float64(x / y);
	elseif (x <= 1.95e-19)
		tmp = Float64(x * Float64(1.0 + Float64(Float64(x / y) - x)));
	else
		tmp = Float64(x / Float64(y + Float64(y / x)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -5.6e+23)
		tmp = x / y;
	elseif (x <= 1.95e-19)
		tmp = x * (1.0 + ((x / y) - x));
	else
		tmp = x / (y + (y / x));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -5.6e+23], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.95e-19], N[(x * N[(1.0 + N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{+23}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;x \leq 1.95 \cdot 10^{-19}:\\
\;\;\;\;x \cdot \left(1 + \left(\frac{x}{y} - x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.6e23

    1. Initial program 74.5%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    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 75.0%

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

    if -5.6e23 < x < 1.94999999999999998e-19

    1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    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 94.8%

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

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot x + \frac{x}{y}\right)}\right) \]
    7. Step-by-step derivation
      1. neg-mul-194.8%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{\left(-x\right)} + \frac{x}{y}\right)\right) \]
      2. +-commutative94.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} + \left(-x\right)\right)}\right) \]
      3. unsub-neg94.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} - x\right)}\right) \]
    8. Simplified94.8%

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

    if 1.94999999999999998e-19 < x

    1. Initial program 76.3%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
      2. un-div-inv100.0%

        \[\leadsto \color{blue}{\frac{x}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
    6. Applied egg-rr100.0%

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

      \[\leadsto \frac{x}{\color{blue}{\frac{y \cdot \left(1 + x\right)}{x}}} \]
    8. Step-by-step derivation
      1. associate-/l*80.6%

        \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    9. Simplified80.6%

      \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    10. Taylor expanded in x around inf 80.6%

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

Alternative 7: 85.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -58000000000 \lor \neg \left(x \leq 9.8 \cdot 10^{-11}\right):\\ \;\;\;\;\frac{x}{y + \frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot \frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= x -58000000000.0) (not (<= x 9.8e-11)))
   (/ x (+ y (/ y x)))
   (+ x (* x (/ x y)))))
double code(double x, double y) {
	double tmp;
	if ((x <= -58000000000.0) || !(x <= 9.8e-11)) {
		tmp = x / (y + (y / x));
	} else {
		tmp = x + (x * (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 <= (-58000000000.0d0)) .or. (.not. (x <= 9.8d-11))) then
        tmp = x / (y + (y / x))
    else
        tmp = x + (x * (x / y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((x <= -58000000000.0) || !(x <= 9.8e-11)) {
		tmp = x / (y + (y / x));
	} else {
		tmp = x + (x * (x / y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (x <= -58000000000.0) or not (x <= 9.8e-11):
		tmp = x / (y + (y / x))
	else:
		tmp = x + (x * (x / y))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((x <= -58000000000.0) || !(x <= 9.8e-11))
		tmp = Float64(x / Float64(y + Float64(y / x)));
	else
		tmp = Float64(x + Float64(x * Float64(x / y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -58000000000.0) || ~((x <= 9.8e-11)))
		tmp = x / (y + (y / x));
	else
		tmp = x + (x * (x / y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[x, -58000000000.0], N[Not[LessEqual[x, 9.8e-11]], $MachinePrecision]], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -58000000000 \lor \neg \left(x \leq 9.8 \cdot 10^{-11}\right):\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.8e10 or 9.7999999999999998e-11 < x

    1. Initial program 75.8%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
      2. un-div-inv100.0%

        \[\leadsto \color{blue}{\frac{x}{\frac{x + 1}{\frac{x}{y} + 1}}} \]
    6. Applied egg-rr100.0%

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

      \[\leadsto \frac{x}{\color{blue}{\frac{y \cdot \left(1 + x\right)}{x}}} \]
    8. Step-by-step derivation
      1. associate-/l*78.4%

        \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    9. Simplified78.4%

      \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1 + x}{x}}} \]
    10. Taylor expanded in x around inf 78.4%

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

    if -5.8e10 < x < 9.7999999999999998e-11

    1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    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 98.0%

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

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot x + \frac{x}{y}\right)}\right) \]
    7. Step-by-step derivation
      1. neg-mul-198.1%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} + \left(-x\right)\right)}\right) \]
      3. unsub-neg98.1%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} - x\right)}\right) \]
    8. Simplified98.1%

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} - x\right)}\right) \]
    9. Step-by-step derivation
      1. +-commutative98.1%

        \[\leadsto x \cdot \color{blue}{\left(\left(\frac{x}{y} - x\right) + 1\right)} \]
      2. distribute-rgt-in98.1%

        \[\leadsto \color{blue}{\left(\frac{x}{y} - x\right) \cdot x + 1 \cdot x} \]
      3. *-commutative98.1%

        \[\leadsto \color{blue}{x \cdot \left(\frac{x}{y} - x\right)} + 1 \cdot x \]
      4. *-un-lft-identity98.1%

        \[\leadsto x \cdot \left(\frac{x}{y} - x\right) + \color{blue}{x} \]
    10. Applied egg-rr98.1%

      \[\leadsto \color{blue}{x \cdot \left(\frac{x}{y} - x\right) + x} \]
    11. Taylor expanded in y around 0 98.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -58000000000 \lor \neg \left(x \leq 9.8 \cdot 10^{-11}\right):\\ \;\;\;\;\frac{x}{y + \frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot \frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 85.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 54\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot \frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= x -1.0) (not (<= x 54.0))) (/ x y) (+ x (* x (/ x y)))))
double code(double x, double y) {
	double tmp;
	if ((x <= -1.0) || !(x <= 54.0)) {
		tmp = x / y;
	} else {
		tmp = x + (x * (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)) .or. (.not. (x <= 54.0d0))) then
        tmp = x / y
    else
        tmp = x + (x * (x / y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((x <= -1.0) || !(x <= 54.0)) {
		tmp = x / y;
	} else {
		tmp = x + (x * (x / y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (x <= -1.0) or not (x <= 54.0):
		tmp = x / y
	else:
		tmp = x + (x * (x / y))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((x <= -1.0) || !(x <= 54.0))
		tmp = Float64(x / y);
	else
		tmp = Float64(x + Float64(x * Float64(x / y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -1.0) || ~((x <= 54.0)))
		tmp = x / y;
	else
		tmp = x + (x * (x / y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 54.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(x + N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 54\right):\\
\;\;\;\;\frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1 or 54 < 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*99.9%

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

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

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

    if -1 < x < 54

    1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    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 99.7%

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

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot x + \frac{x}{y}\right)}\right) \]
    7. Step-by-step derivation
      1. neg-mul-199.7%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} + \left(-x\right)\right)}\right) \]
      3. unsub-neg99.7%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} - x\right)}\right) \]
    8. Simplified99.7%

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} - x\right)}\right) \]
    9. Step-by-step derivation
      1. +-commutative99.7%

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

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

        \[\leadsto \color{blue}{x \cdot \left(\frac{x}{y} - x\right)} + 1 \cdot x \]
      4. *-un-lft-identity99.7%

        \[\leadsto x \cdot \left(\frac{x}{y} - x\right) + \color{blue}{x} \]
    10. Applied egg-rr99.7%

      \[\leadsto \color{blue}{x \cdot \left(\frac{x}{y} - x\right) + x} \]
    11. Taylor expanded in y around 0 99.4%

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

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

Alternative 9: 85.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 13\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 + \frac{x}{y}\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= x -1.0) (not (<= x 13.0))) (/ x y) (* x (+ 1.0 (/ x y)))))
double code(double x, double y) {
	double tmp;
	if ((x <= -1.0) || !(x <= 13.0)) {
		tmp = x / y;
	} else {
		tmp = x * (1.0 + (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)) .or. (.not. (x <= 13.0d0))) then
        tmp = x / y
    else
        tmp = x * (1.0d0 + (x / y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((x <= -1.0) || !(x <= 13.0)) {
		tmp = x / y;
	} else {
		tmp = x * (1.0 + (x / y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (x <= -1.0) or not (x <= 13.0):
		tmp = x / y
	else:
		tmp = x * (1.0 + (x / y))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((x <= -1.0) || !(x <= 13.0))
		tmp = Float64(x / y);
	else
		tmp = Float64(x * Float64(1.0 + Float64(x / y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -1.0) || ~((x <= 13.0)))
		tmp = x / y;
	else
		tmp = x * (1.0 + (x / y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 13.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(x * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 13\right):\\
\;\;\;\;\frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{x}{y}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1 or 13 < 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*99.9%

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

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

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

    if -1 < x < 13

    1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    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 99.7%

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

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot x + \frac{x}{y}\right)}\right) \]
    7. Step-by-step derivation
      1. neg-mul-199.7%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} + \left(-x\right)\right)}\right) \]
      3. unsub-neg99.7%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(\frac{x}{y} - x\right)}\right) \]
    8. Simplified99.7%

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

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

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

Alternative 10: 73.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{+27} \lor \neg \left(x \leq 8.5 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.60000000000000043e27 or 8.5e-17 < x

    1. Initial program 74.7%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

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

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

    if -7.60000000000000043e27 < x < 8.5e-17

    1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot x\right)} \]
    7. Step-by-step derivation
      1. neg-mul-170.9%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-x\right)}\right) \]
      2. sub-neg70.9%

        \[\leadsto x \cdot \color{blue}{\left(1 - x\right)} \]
    8. Simplified70.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.6 \cdot 10^{+27} \lor \neg \left(x \leq 8.5 \cdot 10^{-17}\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 74.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -58000000000 \lor \neg \left(x \leq 19\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= x -58000000000.0) (not (<= x 19.0))) (/ x y) x))
double code(double x, double y) {
	double tmp;
	if ((x <= -58000000000.0) || !(x <= 19.0)) {
		tmp = x / y;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((x <= (-58000000000.0d0)) .or. (.not. (x <= 19.0d0))) then
        tmp = x / y
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((x <= -58000000000.0) || !(x <= 19.0)) {
		tmp = x / y;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (x <= -58000000000.0) or not (x <= 19.0):
		tmp = x / y
	else:
		tmp = x
	return tmp
function code(x, y)
	tmp = 0.0
	if ((x <= -58000000000.0) || !(x <= 19.0))
		tmp = Float64(x / y);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -58000000000.0) || ~((x <= 19.0)))
		tmp = x / y;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[x, -58000000000.0], N[Not[LessEqual[x, 19.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -58000000000 \lor \neg \left(x \leq 19\right):\\
\;\;\;\;\frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.8e10 or 19 < x

    1. Initial program 75.6%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

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

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

    if -5.8e10 < x < 19

    1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    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 75.1%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification77.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -58000000000 \lor \neg \left(x \leq 19\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 49.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -6600000:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-17}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -6600000.0) 1.0 (if (<= x 8.5e-17) x 1.0)))
double code(double x, double y) {
	double tmp;
	if (x <= -6600000.0) {
		tmp = 1.0;
	} else if (x <= 8.5e-17) {
		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 <= (-6600000.0d0)) then
        tmp = 1.0d0
    else if (x <= 8.5d-17) 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 <= -6600000.0) {
		tmp = 1.0;
	} else if (x <= 8.5e-17) {
		tmp = x;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -6600000.0:
		tmp = 1.0
	elif x <= 8.5e-17:
		tmp = x
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -6600000.0)
		tmp = 1.0;
	elseif (x <= 8.5e-17)
		tmp = x;
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -6600000.0)
		tmp = 1.0;
	elseif (x <= 8.5e-17)
		tmp = x;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -6600000.0], 1.0, If[LessEqual[x, 8.5e-17], x, 1.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6600000:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq 8.5 \cdot 10^{-17}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.6e6 or 8.5e-17 < x

    1. Initial program 76.1%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    3. Simplified99.9%

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

      \[\leadsto x \cdot \color{blue}{\frac{1}{1 + x}} \]
    6. Step-by-step derivation
      1. div-inv24.3%

        \[\leadsto \color{blue}{\frac{x}{1 + x}} \]
      2. +-commutative24.3%

        \[\leadsto \frac{x}{\color{blue}{x + 1}} \]
    7. Applied egg-rr24.3%

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

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

    if -6.6e6 < x < 8.5e-17

    1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
    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 75.6%

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

Alternative 13: 99.9% 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 86.9%

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
  3. Simplified99.9%

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

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

Alternative 14: 14.9% 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 86.9%

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y} + 1}{x + 1}} \]
  3. Simplified99.9%

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

    \[\leadsto x \cdot \color{blue}{\frac{1}{1 + x}} \]
  6. Step-by-step derivation
    1. div-inv48.0%

      \[\leadsto \color{blue}{\frac{x}{1 + x}} \]
    2. +-commutative48.0%

      \[\leadsto \frac{x}{\color{blue}{x + 1}} \]
  7. Applied egg-rr48.0%

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

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

Developer target: 99.9% 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 2024107 
(FPCore (x y)
  :name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
  :precision binary64

  :alt
  (* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0)))

  (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))