Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1

Percentage Accurate: 88.3% → 99.8%
Time: 8.6s
Alternatives: 10
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 10 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.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

    \[\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. Final simplification99.8%

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

Alternative 2: 72.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{x}{y}\\ \mathbf{if}\;x \leq -3 \cdot 10^{+22}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq -9.8 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-52}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 10^{-82}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* x (/ x y))))
   (if (<= x -3e+22)
     (/ x y)
     (if (<= x -9.8e-17)
       (/ x (+ x 1.0))
       (if (<= x -2e-52)
         t_0
         (if (<= x 1e-82) x (if (<= x 1.0) t_0 (/ x y))))))))
double code(double x, double y) {
	double t_0 = x * (x / y);
	double tmp;
	if (x <= -3e+22) {
		tmp = x / y;
	} else if (x <= -9.8e-17) {
		tmp = x / (x + 1.0);
	} else if (x <= -2e-52) {
		tmp = t_0;
	} else if (x <= 1e-82) {
		tmp = x;
	} else if (x <= 1.0) {
		tmp = t_0;
	} else {
		tmp = x / y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * (x / y)
    if (x <= (-3d+22)) then
        tmp = x / y
    else if (x <= (-9.8d-17)) then
        tmp = x / (x + 1.0d0)
    else if (x <= (-2d-52)) then
        tmp = t_0
    else if (x <= 1d-82) then
        tmp = x
    else if (x <= 1.0d0) then
        tmp = t_0
    else
        tmp = x / y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x * (x / y);
	double tmp;
	if (x <= -3e+22) {
		tmp = x / y;
	} else if (x <= -9.8e-17) {
		tmp = x / (x + 1.0);
	} else if (x <= -2e-52) {
		tmp = t_0;
	} else if (x <= 1e-82) {
		tmp = x;
	} else if (x <= 1.0) {
		tmp = t_0;
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y):
	t_0 = x * (x / y)
	tmp = 0
	if x <= -3e+22:
		tmp = x / y
	elif x <= -9.8e-17:
		tmp = x / (x + 1.0)
	elif x <= -2e-52:
		tmp = t_0
	elif x <= 1e-82:
		tmp = x
	elif x <= 1.0:
		tmp = t_0
	else:
		tmp = x / y
	return tmp
function code(x, y)
	t_0 = Float64(x * Float64(x / y))
	tmp = 0.0
	if (x <= -3e+22)
		tmp = Float64(x / y);
	elseif (x <= -9.8e-17)
		tmp = Float64(x / Float64(x + 1.0));
	elseif (x <= -2e-52)
		tmp = t_0;
	elseif (x <= 1e-82)
		tmp = x;
	elseif (x <= 1.0)
		tmp = t_0;
	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 <= -3e+22)
		tmp = x / y;
	elseif (x <= -9.8e-17)
		tmp = x / (x + 1.0);
	elseif (x <= -2e-52)
		tmp = t_0;
	elseif (x <= 1e-82)
		tmp = x;
	elseif (x <= 1.0)
		tmp = t_0;
	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, -3e+22], N[(x / y), $MachinePrecision], If[LessEqual[x, -9.8e-17], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2e-52], t$95$0, If[LessEqual[x, 1e-82], x, If[LessEqual[x, 1.0], t$95$0, N[(x / y), $MachinePrecision]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \leq -2 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 10^{-82}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 76.4%

      \[\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 82.0%

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

    if -3e22 < x < -9.80000000000000024e-17

    1. Initial program 100.0%

      \[\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 73.5%

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

    if -9.80000000000000024e-17 < x < -2e-52 or 1e-82 < x < 1

    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. Taylor expanded in y around 0 77.6%

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

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

    if -2e-52 < x < 1e-82

    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 86.9%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification83.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3 \cdot 10^{+22}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq -9.8 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-52}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 10^{-82}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 72.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+19}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq -9.4 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-52}:\\ \;\;\;\;x \cdot \left(\frac{x}{y} - x\right)\\ \mathbf{elif}\;x \leq 3.9 \cdot 10^{-89}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -5e+19)
   (/ x y)
   (if (<= x -9.4e-17)
     (/ x (+ x 1.0))
     (if (<= x -3e-52)
       (* x (- (/ x y) x))
       (if (<= x 3.9e-89) x (if (<= x 1.0) (* x (/ x y)) (/ x y)))))))
double code(double x, double y) {
	double tmp;
	if (x <= -5e+19) {
		tmp = x / y;
	} else if (x <= -9.4e-17) {
		tmp = x / (x + 1.0);
	} else if (x <= -3e-52) {
		tmp = x * ((x / y) - x);
	} else if (x <= 3.9e-89) {
		tmp = x;
	} else if (x <= 1.0) {
		tmp = x * (x / y);
	} 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 <= (-5d+19)) then
        tmp = x / y
    else if (x <= (-9.4d-17)) then
        tmp = x / (x + 1.0d0)
    else if (x <= (-3d-52)) then
        tmp = x * ((x / y) - x)
    else if (x <= 3.9d-89) then
        tmp = x
    else if (x <= 1.0d0) then
        tmp = x * (x / y)
    else
        tmp = x / y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -5e+19) {
		tmp = x / y;
	} else if (x <= -9.4e-17) {
		tmp = x / (x + 1.0);
	} else if (x <= -3e-52) {
		tmp = x * ((x / y) - x);
	} else if (x <= 3.9e-89) {
		tmp = x;
	} else if (x <= 1.0) {
		tmp = x * (x / y);
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -5e+19:
		tmp = x / y
	elif x <= -9.4e-17:
		tmp = x / (x + 1.0)
	elif x <= -3e-52:
		tmp = x * ((x / y) - x)
	elif x <= 3.9e-89:
		tmp = x
	elif x <= 1.0:
		tmp = x * (x / y)
	else:
		tmp = x / y
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -5e+19)
		tmp = Float64(x / y);
	elseif (x <= -9.4e-17)
		tmp = Float64(x / Float64(x + 1.0));
	elseif (x <= -3e-52)
		tmp = Float64(x * Float64(Float64(x / y) - x));
	elseif (x <= 3.9e-89)
		tmp = x;
	elseif (x <= 1.0)
		tmp = Float64(x * Float64(x / y));
	else
		tmp = Float64(x / y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -5e+19)
		tmp = x / y;
	elseif (x <= -9.4e-17)
		tmp = x / (x + 1.0);
	elseif (x <= -3e-52)
		tmp = x * ((x / y) - x);
	elseif (x <= 3.9e-89)
		tmp = x;
	elseif (x <= 1.0)
		tmp = x * (x / y);
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -5e+19], N[(x / y), $MachinePrecision], If[LessEqual[x, -9.4e-17], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3e-52], N[(x * N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.9e-89], x, If[LessEqual[x, 1.0], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \leq -3 \cdot 10^{-52}:\\
\;\;\;\;x \cdot \left(\frac{x}{y} - x\right)\\

\mathbf{elif}\;x \leq 3.9 \cdot 10^{-89}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;x \cdot \frac{x}{y}\\

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


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

    1. Initial program 76.4%

      \[\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 82.0%

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

    if -5e19 < x < -9.3999999999999999e-17

    1. Initial program 100.0%

      \[\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 73.5%

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

    if -9.3999999999999999e-17 < x < -3e-52

    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. Taylor expanded in x around 0 99.4%

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

      \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{y} - 1\right)} \]
    7. Step-by-step derivation
      1. unpow274.8%

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot \left(\frac{1}{y} - 1\right) \]
      2. associate-*r*74.8%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\frac{\color{blue}{-\left(-x\right)}}{y} + x \cdot -1\right) \]
      9. remove-double-neg74.9%

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

        \[\leadsto x \cdot \left(\frac{x}{y} + \color{blue}{-1 \cdot x}\right) \]
      11. neg-mul-174.9%

        \[\leadsto x \cdot \left(\frac{x}{y} + \color{blue}{\left(-x\right)}\right) \]
      12. unsub-neg74.9%

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

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

    if -3e-52 < x < 3.89999999999999978e-89

    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 86.9%

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

    if 3.89999999999999978e-89 < x < 1

    1. Initial program 99.5%

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

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

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

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

      \[\leadsto x \cdot \frac{x}{\color{blue}{y}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification83.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+19}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq -9.4 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-52}:\\ \;\;\;\;x \cdot \left(\frac{x}{y} - x\right)\\ \mathbf{elif}\;x \leq 3.9 \cdot 10^{-89}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 73.3% accurate, 0.4× speedup?

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

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

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

\mathbf{elif}\;x \leq -6 \cdot 10^{-52} \lor \neg \left(x \leq 2.8 \cdot 10^{-82}\right):\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -5.2e19

    1. Initial program 74.4%

      \[\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 x around inf 86.3%

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

    if -5.2e19 < x < -1.2500000000000001e-16

    1. Initial program 100.0%

      \[\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 73.5%

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

    if -1.2500000000000001e-16 < x < -6e-52 or 2.80000000000000024e-82 < x

    1. Initial program 84.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. Taylor expanded in y around 0 68.8%

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

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

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

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

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

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

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

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

    if -6e-52 < x < 2.80000000000000024e-82

    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 86.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.2 \cdot 10^{+19}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq -1.25 \cdot 10^{-16}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{-52} \lor \neg \left(x \leq 2.8 \cdot 10^{-82}\right):\\ \;\;\;\;\frac{x}{y + \frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 72.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{x}{y}\\ \mathbf{if}\;x \leq -75000000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq -1.36 \cdot 10^{-52}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{-89}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* x (/ x y))))
   (if (<= x -75000000000.0)
     (/ x y)
     (if (<= x -1.36e-52)
       t_0
       (if (<= x 7.5e-89) x (if (<= x 1.0) t_0 (/ x y)))))))
double code(double x, double y) {
	double t_0 = x * (x / y);
	double tmp;
	if (x <= -75000000000.0) {
		tmp = x / y;
	} else if (x <= -1.36e-52) {
		tmp = t_0;
	} else if (x <= 7.5e-89) {
		tmp = x;
	} else if (x <= 1.0) {
		tmp = t_0;
	} else {
		tmp = x / y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * (x / y)
    if (x <= (-75000000000.0d0)) then
        tmp = x / y
    else if (x <= (-1.36d-52)) then
        tmp = t_0
    else if (x <= 7.5d-89) then
        tmp = x
    else if (x <= 1.0d0) then
        tmp = t_0
    else
        tmp = x / y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x * (x / y);
	double tmp;
	if (x <= -75000000000.0) {
		tmp = x / y;
	} else if (x <= -1.36e-52) {
		tmp = t_0;
	} else if (x <= 7.5e-89) {
		tmp = x;
	} else if (x <= 1.0) {
		tmp = t_0;
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y):
	t_0 = x * (x / y)
	tmp = 0
	if x <= -75000000000.0:
		tmp = x / y
	elif x <= -1.36e-52:
		tmp = t_0
	elif x <= 7.5e-89:
		tmp = x
	elif x <= 1.0:
		tmp = t_0
	else:
		tmp = x / y
	return tmp
function code(x, y)
	t_0 = Float64(x * Float64(x / y))
	tmp = 0.0
	if (x <= -75000000000.0)
		tmp = Float64(x / y);
	elseif (x <= -1.36e-52)
		tmp = t_0;
	elseif (x <= 7.5e-89)
		tmp = x;
	elseif (x <= 1.0)
		tmp = t_0;
	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 <= -75000000000.0)
		tmp = x / y;
	elseif (x <= -1.36e-52)
		tmp = t_0;
	elseif (x <= 7.5e-89)
		tmp = x;
	elseif (x <= 1.0)
		tmp = t_0;
	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, -75000000000.0], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.36e-52], t$95$0, If[LessEqual[x, 7.5e-89], x, If[LessEqual[x, 1.0], t$95$0, N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -1.36 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 7.5 \cdot 10^{-89}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 76.6%

      \[\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 81.3%

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

    if -7.5e10 < x < -1.36e-52 or 7.4999999999999999e-89 < x < 1

    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. Taylor expanded in y around 0 65.9%

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

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

    if -1.36e-52 < x < 7.4999999999999999e-89

    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 86.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -75000000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;x \leq -1.36 \cdot 10^{-52}:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{-89}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 86.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x + y}{y}\\
\mathbf{if}\;x \leq -4.4 \cdot 10^{+19}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq 66000000000000:\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.4e19 or 6.6e13 < 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.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 y around 0 68.5%

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{1 + x} + \frac{{x}^{2}}{1 + x}}{y}} \]
    6. Step-by-step derivation
      1. *-commutative68.5%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{1 + x} + \frac{{x}^{2}}{1 + x}}{y} \]
      2. +-commutative68.5%

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{x + 1}} + \frac{{x}^{2}}{1 + x}}{y} \]
      3. associate-/l*73.8%

        \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{x + 1}} + \frac{{x}^{2}}{1 + x}}{y} \]
      4. *-lft-identity73.8%

        \[\leadsto \frac{y \cdot \frac{\color{blue}{1 \cdot x}}{x + 1} + \frac{{x}^{2}}{1 + x}}{y} \]
      5. associate-*l/73.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot x}{x + 1}} \cdot \left(y + x\right)}{y} \]
      13. *-lft-identity100.0%

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

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

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

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

    if -4.4e19 < x < 3.39999999999999975e-82

    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 80.1%

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

    if 3.39999999999999975e-82 < x < 6.6e13

    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.5%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.4 \cdot 10^{+19}:\\ \;\;\;\;\frac{x + y}{y}\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{-82}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq 66000000000000:\\ \;\;\;\;\frac{x}{y + \frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 98.1% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 77.2%

      \[\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 y around 0 70.3%

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{1 + x} + \frac{{x}^{2}}{1 + x}}{y}} \]
    6. Step-by-step derivation
      1. *-commutative70.3%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{1 + x} + \frac{{x}^{2}}{1 + x}}{y} \]
      2. +-commutative70.3%

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{x + 1}} + \frac{{x}^{2}}{1 + x}}{y} \]
      3. associate-/l*75.3%

        \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{x + 1}} + \frac{{x}^{2}}{1 + x}}{y} \]
      4. *-lft-identity75.3%

        \[\leadsto \frac{y \cdot \frac{\color{blue}{1 \cdot x}}{x + 1} + \frac{{x}^{2}}{1 + x}}{y} \]
      5. associate-*l/75.2%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot x}{x + 1}} \cdot \left(y + x\right)}{y} \]
      13. *-lft-identity100.0%

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

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

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

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

    if -1 < x < 0.80000000000000004

    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 97.3%

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

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

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

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

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

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

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

Alternative 8: 73.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 4 \cdot 10^{-18}\right):\\
\;\;\;\;\frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1 or 4.0000000000000003e-18 < x

    1. Initial program 77.9%

      \[\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 77.2%

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

    if -1 < x < 4.0000000000000003e-18

    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 72.1%

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

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

Alternative 9: 50.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-18}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y) :precision binary64 (if (<= x -1.0) 1.0 (if (<= x 4e-18) x 1.0)))
double code(double x, double y) {
	double tmp;
	if (x <= -1.0) {
		tmp = 1.0;
	} else if (x <= 4e-18) {
		tmp = x;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.0d0)) then
        tmp = 1.0d0
    else if (x <= 4d-18) then
        tmp = x
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.0) {
		tmp = 1.0;
	} else if (x <= 4e-18) {
		tmp = x;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -1.0:
		tmp = 1.0
	elif x <= 4e-18:
		tmp = x
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -1.0)
		tmp = 1.0;
	elseif (x <= 4e-18)
		tmp = x;
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.0)
		tmp = 1.0;
	elseif (x <= 4e-18)
		tmp = x;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -1.0], 1.0, If[LessEqual[x, 4e-18], x, 1.0]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 4 \cdot 10^{-18}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1 or 4.0000000000000003e-18 < x

    1. Initial program 77.9%

      \[\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 y around inf 21.4%

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

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

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

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

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

    if -1 < x < 4.0000000000000003e-18

    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 72.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-18}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 15.5% 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 89.0%

    \[\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 y around inf 47.7%

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  9. Final simplification11.4%

    \[\leadsto 1 \]
  10. Add Preprocessing

Developer target: 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 2024055 
(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)))