Diagrams.TwoD.Arc:bezierFromSweepQ1 from diagrams-lib-1.3.0.3

Percentage Accurate: 94.0% → 99.6%
Time: 9.9s
Alternatives: 15
Speedup: 1.0×

Specification

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

\\
\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}
\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 15 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: 94.0% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := \left(3 - x\right) \cdot \left(1 - x\right)\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+98}:\\
\;\;\;\;\frac{t\_0}{3 \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 3 binary64) x)) < 2e98

    1. Initial program 99.6%

      \[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3} \]
    2. Add Preprocessing

    if 2e98 < (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 3 binary64) x))

    1. Initial program 90.9%

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

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

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

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

      \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 3} \]
    6. Step-by-step derivation
      1. times-fracN/A

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

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

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

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

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

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

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

Alternative 2: 98.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.75:\\ \;\;\;\;\frac{\frac{x + -4}{y}}{\frac{3}{x}}\\ \mathbf{elif}\;x \leq 1.7:\\ \;\;\;\;\frac{1}{\frac{y}{1 + x \cdot -1.3333333333333333}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + -4}{\frac{3 \cdot y}{x}}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -1.75)
   (/ (/ (+ x -4.0) y) (/ 3.0 x))
   (if (<= x 1.7)
     (/ 1.0 (/ y (+ 1.0 (* x -1.3333333333333333))))
     (/ (+ x -4.0) (/ (* 3.0 y) x)))))
double code(double x, double y) {
	double tmp;
	if (x <= -1.75) {
		tmp = ((x + -4.0) / y) / (3.0 / x);
	} else if (x <= 1.7) {
		tmp = 1.0 / (y / (1.0 + (x * -1.3333333333333333)));
	} else {
		tmp = (x + -4.0) / ((3.0 * 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.75d0)) then
        tmp = ((x + (-4.0d0)) / y) / (3.0d0 / x)
    else if (x <= 1.7d0) then
        tmp = 1.0d0 / (y / (1.0d0 + (x * (-1.3333333333333333d0))))
    else
        tmp = (x + (-4.0d0)) / ((3.0d0 * y) / x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.75) {
		tmp = ((x + -4.0) / y) / (3.0 / x);
	} else if (x <= 1.7) {
		tmp = 1.0 / (y / (1.0 + (x * -1.3333333333333333)));
	} else {
		tmp = (x + -4.0) / ((3.0 * y) / x);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -1.75:
		tmp = ((x + -4.0) / y) / (3.0 / x)
	elif x <= 1.7:
		tmp = 1.0 / (y / (1.0 + (x * -1.3333333333333333)))
	else:
		tmp = (x + -4.0) / ((3.0 * y) / x)
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -1.75)
		tmp = Float64(Float64(Float64(x + -4.0) / y) / Float64(3.0 / x));
	elseif (x <= 1.7)
		tmp = Float64(1.0 / Float64(y / Float64(1.0 + Float64(x * -1.3333333333333333))));
	else
		tmp = Float64(Float64(x + -4.0) / Float64(Float64(3.0 * y) / x));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.75)
		tmp = ((x + -4.0) / y) / (3.0 / x);
	elseif (x <= 1.7)
		tmp = 1.0 / (y / (1.0 + (x * -1.3333333333333333)));
	else
		tmp = (x + -4.0) / ((3.0 * y) / x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -1.75], N[(N[(N[(x + -4.0), $MachinePrecision] / y), $MachinePrecision] / N[(3.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.7], N[(1.0 / N[(y / N[(1.0 + N[(x * -1.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + -4.0), $MachinePrecision] / N[(N[(3.0 * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75:\\
\;\;\;\;\frac{\frac{x + -4}{y}}{\frac{3}{x}}\\

\mathbf{elif}\;x \leq 1.7:\\
\;\;\;\;\frac{1}{\frac{y}{1 + x \cdot -1.3333333333333333}}\\

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


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

    1. Initial program 93.6%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left({x}^{2} \cdot \left(1 - 4 \cdot \frac{1}{x}\right)\right)}, \mathsf{*.f64}\left(y, 3\right)\right) \]
    4. Step-by-step derivation
      1. sub-negN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \frac{{x}^{2}}{x}\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      8. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot \frac{x}{x}\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      10. *-rgt-identityN/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot \left(x \cdot \frac{1}{x}\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      12. rgt-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot 1\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      13. *-rgt-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot x\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left({x}^{2} + -4 \cdot x\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      15. unpow2N/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot \left(x + \left(\mathsf{neg}\left(4\right)\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      18. sub-negN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x - 4\right)\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
      20. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x + \left(\mathsf{neg}\left(4\right)\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      21. metadata-evalN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(x, -4\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
    5. Simplified92.3%

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

        \[\leadsto \frac{\left(x + -4\right) \cdot x}{\color{blue}{y} \cdot 3} \]
      2. times-fracN/A

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -4\right), y\right), \left(\frac{3}{x}\right)\right) \]
      8. /-lowering-/.f6498.6%

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

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

    if -1.75 < x < 1.69999999999999996

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\left(\mathsf{neg}\left(\frac{4}{3}\right)\right) \cdot \frac{1}{y}\right) + \frac{1}{y} \]
      8. metadata-evalN/A

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

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

        \[\leadsto \left(\frac{-4}{3} \cdot x\right) \cdot \frac{1}{y} + \frac{1}{y} \]
      11. distribute-lft1-inN/A

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

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

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

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

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

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

        \[\leadsto \frac{\frac{-4}{3} \cdot x + 1}{\color{blue}{y}} \]
      2. clear-numN/A

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(1, \left(x \cdot \color{blue}{\frac{-4}{3}}\right)\right)\right)\right) \]
      8. *-lowering-*.f6499.5%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \color{blue}{\frac{-4}{3}}\right)\right)\right)\right) \]
    7. Applied egg-rr99.5%

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

    if 1.69999999999999996 < x

    1. Initial program 91.6%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left({x}^{2} \cdot \left(1 - 4 \cdot \frac{1}{x}\right)\right)}, \mathsf{*.f64}\left(y, 3\right)\right) \]
    4. Step-by-step derivation
      1. sub-negN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \frac{{x}^{2}}{x}\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      8. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot \frac{x}{x}\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      10. *-rgt-identityN/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot \left(x \cdot \frac{1}{x}\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      12. rgt-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot 1\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      13. *-rgt-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot x\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left({x}^{2} + -4 \cdot x\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      15. unpow2N/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot \left(x + \left(\mathsf{neg}\left(4\right)\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      18. sub-negN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x - 4\right)\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
      20. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x + \left(\mathsf{neg}\left(4\right)\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      21. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x + -4\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      22. +-lowering-+.f6489.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(x, -4\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
    5. Simplified89.8%

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

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

        \[\leadsto \left(x + -4\right) \cdot \color{blue}{\frac{x}{y \cdot 3}} \]
      3. clear-numN/A

        \[\leadsto \left(x + -4\right) \cdot \frac{1}{\color{blue}{\frac{y \cdot 3}{x}}} \]
      4. un-div-invN/A

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -4\right), \mathsf{/.f64}\left(\left(3 \cdot y\right), x\right)\right) \]
      9. *-lowering-*.f6497.8%

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

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

Alternative 3: 98.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.75:\\ \;\;\;\;\frac{x}{3} \cdot \frac{x + -4}{y}\\ \mathbf{elif}\;x \leq 1.7:\\ \;\;\;\;\frac{1}{\frac{y}{1 + x \cdot -1.3333333333333333}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + -4}{\frac{3 \cdot y}{x}}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -1.75)
   (* (/ x 3.0) (/ (+ x -4.0) y))
   (if (<= x 1.7)
     (/ 1.0 (/ y (+ 1.0 (* x -1.3333333333333333))))
     (/ (+ x -4.0) (/ (* 3.0 y) x)))))
double code(double x, double y) {
	double tmp;
	if (x <= -1.75) {
		tmp = (x / 3.0) * ((x + -4.0) / y);
	} else if (x <= 1.7) {
		tmp = 1.0 / (y / (1.0 + (x * -1.3333333333333333)));
	} else {
		tmp = (x + -4.0) / ((3.0 * 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.75d0)) then
        tmp = (x / 3.0d0) * ((x + (-4.0d0)) / y)
    else if (x <= 1.7d0) then
        tmp = 1.0d0 / (y / (1.0d0 + (x * (-1.3333333333333333d0))))
    else
        tmp = (x + (-4.0d0)) / ((3.0d0 * y) / x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.75) {
		tmp = (x / 3.0) * ((x + -4.0) / y);
	} else if (x <= 1.7) {
		tmp = 1.0 / (y / (1.0 + (x * -1.3333333333333333)));
	} else {
		tmp = (x + -4.0) / ((3.0 * y) / x);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -1.75:
		tmp = (x / 3.0) * ((x + -4.0) / y)
	elif x <= 1.7:
		tmp = 1.0 / (y / (1.0 + (x * -1.3333333333333333)))
	else:
		tmp = (x + -4.0) / ((3.0 * y) / x)
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -1.75)
		tmp = Float64(Float64(x / 3.0) * Float64(Float64(x + -4.0) / y));
	elseif (x <= 1.7)
		tmp = Float64(1.0 / Float64(y / Float64(1.0 + Float64(x * -1.3333333333333333))));
	else
		tmp = Float64(Float64(x + -4.0) / Float64(Float64(3.0 * y) / x));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.75)
		tmp = (x / 3.0) * ((x + -4.0) / y);
	elseif (x <= 1.7)
		tmp = 1.0 / (y / (1.0 + (x * -1.3333333333333333)));
	else
		tmp = (x + -4.0) / ((3.0 * y) / x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -1.75], N[(N[(x / 3.0), $MachinePrecision] * N[(N[(x + -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.7], N[(1.0 / N[(y / N[(1.0 + N[(x * -1.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + -4.0), $MachinePrecision] / N[(N[(3.0 * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75:\\
\;\;\;\;\frac{x}{3} \cdot \frac{x + -4}{y}\\

\mathbf{elif}\;x \leq 1.7:\\
\;\;\;\;\frac{1}{\frac{y}{1 + x \cdot -1.3333333333333333}}\\

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


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

    1. Initial program 93.6%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left({x}^{2} \cdot \left(1 - 4 \cdot \frac{1}{x}\right)\right)}, \mathsf{*.f64}\left(y, 3\right)\right) \]
    4. Step-by-step derivation
      1. sub-negN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \frac{{x}^{2}}{x}\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      8. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot \frac{x}{x}\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      10. *-rgt-identityN/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot \left(x \cdot \frac{1}{x}\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      12. rgt-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot 1\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      13. *-rgt-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot x\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left({x}^{2} + -4 \cdot x\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      15. unpow2N/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot \left(x + \left(\mathsf{neg}\left(4\right)\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      18. sub-negN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x - 4\right)\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
      20. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x + \left(\mathsf{neg}\left(4\right)\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      21. metadata-evalN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(x, -4\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
    5. Simplified92.3%

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

        \[\leadsto \frac{\left(x + -4\right) \cdot x}{\color{blue}{y} \cdot 3} \]
      2. times-fracN/A

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

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

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

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

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

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

    if -1.75 < x < 1.69999999999999996

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\left(\mathsf{neg}\left(\frac{4}{3}\right)\right) \cdot \frac{1}{y}\right) + \frac{1}{y} \]
      8. metadata-evalN/A

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

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

        \[\leadsto \left(\frac{-4}{3} \cdot x\right) \cdot \frac{1}{y} + \frac{1}{y} \]
      11. distribute-lft1-inN/A

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

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

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

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

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

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

        \[\leadsto \frac{\frac{-4}{3} \cdot x + 1}{\color{blue}{y}} \]
      2. clear-numN/A

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(1, \left(x \cdot \color{blue}{\frac{-4}{3}}\right)\right)\right)\right) \]
      8. *-lowering-*.f6499.5%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \color{blue}{\frac{-4}{3}}\right)\right)\right)\right) \]
    7. Applied egg-rr99.5%

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

    if 1.69999999999999996 < x

    1. Initial program 91.6%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left({x}^{2} \cdot \left(1 - 4 \cdot \frac{1}{x}\right)\right)}, \mathsf{*.f64}\left(y, 3\right)\right) \]
    4. Step-by-step derivation
      1. sub-negN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \frac{{x}^{2}}{x}\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      8. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot \frac{x}{x}\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      10. *-rgt-identityN/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot \left(x \cdot \frac{1}{x}\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      12. rgt-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot 1\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      13. *-rgt-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot x\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left({x}^{2} + -4 \cdot x\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      15. unpow2N/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot \left(x + \left(\mathsf{neg}\left(4\right)\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      18. sub-negN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x - 4\right)\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
      20. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x + \left(\mathsf{neg}\left(4\right)\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      21. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x + -4\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      22. +-lowering-+.f6489.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(x, -4\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
    5. Simplified89.8%

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

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

        \[\leadsto \left(x + -4\right) \cdot \color{blue}{\frac{x}{y \cdot 3}} \]
      3. clear-numN/A

        \[\leadsto \left(x + -4\right) \cdot \frac{1}{\color{blue}{\frac{y \cdot 3}{x}}} \]
      4. un-div-invN/A

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -4\right), \mathsf{/.f64}\left(\left(3 \cdot y\right), x\right)\right) \]
      9. *-lowering-*.f6497.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.75:\\ \;\;\;\;\frac{x}{3} \cdot \frac{x + -4}{y}\\ \mathbf{elif}\;x \leq 1.7:\\ \;\;\;\;\frac{1}{\frac{y}{1 + x \cdot -1.3333333333333333}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + -4}{\frac{3 \cdot y}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 99.0% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;x \leq 1.7:\\
\;\;\;\;\frac{1}{\frac{y}{1 + x \cdot -1.3333333333333333}}\\

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


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

    1. Initial program 92.6%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left({x}^{2} \cdot \left(1 - 4 \cdot \frac{1}{x}\right)\right)}, \mathsf{*.f64}\left(y, 3\right)\right) \]
    4. Step-by-step derivation
      1. sub-negN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \frac{{x}^{2}}{x}\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      8. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot \frac{x}{x}\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      10. *-rgt-identityN/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot \left(x \cdot \frac{1}{x}\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      12. rgt-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot 1\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      13. *-rgt-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot x\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left({x}^{2} + -4 \cdot x\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      15. unpow2N/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot \left(x + \left(\mathsf{neg}\left(4\right)\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      18. sub-negN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x - 4\right)\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
      20. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x + \left(\mathsf{neg}\left(4\right)\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      21. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x + -4\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      22. +-lowering-+.f6491.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(x, -4\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
    5. Simplified91.1%

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

        \[\leadsto \frac{\left(x + -4\right) \cdot x}{\color{blue}{y} \cdot 3} \]
      2. times-fracN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -4\right), y\right), \mathsf{/.f64}\left(x, \color{blue}{3}\right)\right) \]
    7. Applied egg-rr98.2%

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

    if -1.75 < x < 1.69999999999999996

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\left(\mathsf{neg}\left(\frac{4}{3}\right)\right) \cdot \frac{1}{y}\right) + \frac{1}{y} \]
      8. metadata-evalN/A

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

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

        \[\leadsto \left(\frac{-4}{3} \cdot x\right) \cdot \frac{1}{y} + \frac{1}{y} \]
      11. distribute-lft1-inN/A

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

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

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

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

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

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

        \[\leadsto \frac{\frac{-4}{3} \cdot x + 1}{\color{blue}{y}} \]
      2. clear-numN/A

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(1, \left(x \cdot \color{blue}{\frac{-4}{3}}\right)\right)\right)\right) \]
      8. *-lowering-*.f6499.5%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \color{blue}{\frac{-4}{3}}\right)\right)\right)\right) \]
    7. Applied egg-rr99.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.75:\\ \;\;\;\;\frac{x}{3} \cdot \frac{x + -4}{y}\\ \mathbf{elif}\;x \leq 1.7:\\ \;\;\;\;\frac{1}{\frac{y}{1 + x \cdot -1.3333333333333333}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{3} \cdot \frac{x + -4}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{3} \cdot \frac{x + -4}{y}\\ \mathbf{if}\;x \leq -1.75:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.7:\\ \;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (/ x 3.0) (/ (+ x -4.0) y))))
   (if (<= x -1.75)
     t_0
     (if (<= x 1.7) (/ (+ 1.0 (* x -1.3333333333333333)) y) t_0))))
double code(double x, double y) {
	double t_0 = (x / 3.0) * ((x + -4.0) / y);
	double tmp;
	if (x <= -1.75) {
		tmp = t_0;
	} else if (x <= 1.7) {
		tmp = (1.0 + (x * -1.3333333333333333)) / y;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x / 3.0d0) * ((x + (-4.0d0)) / y)
    if (x <= (-1.75d0)) then
        tmp = t_0
    else if (x <= 1.7d0) then
        tmp = (1.0d0 + (x * (-1.3333333333333333d0))) / y
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (x / 3.0) * ((x + -4.0) / y);
	double tmp;
	if (x <= -1.75) {
		tmp = t_0;
	} else if (x <= 1.7) {
		tmp = (1.0 + (x * -1.3333333333333333)) / y;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = (x / 3.0) * ((x + -4.0) / y)
	tmp = 0
	if x <= -1.75:
		tmp = t_0
	elif x <= 1.7:
		tmp = (1.0 + (x * -1.3333333333333333)) / y
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(Float64(x / 3.0) * Float64(Float64(x + -4.0) / y))
	tmp = 0.0
	if (x <= -1.75)
		tmp = t_0;
	elseif (x <= 1.7)
		tmp = Float64(Float64(1.0 + Float64(x * -1.3333333333333333)) / y);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (x / 3.0) * ((x + -4.0) / y);
	tmp = 0.0;
	if (x <= -1.75)
		tmp = t_0;
	elseif (x <= 1.7)
		tmp = (1.0 + (x * -1.3333333333333333)) / y;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(x / 3.0), $MachinePrecision] * N[(N[(x + -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.75], t$95$0, If[LessEqual[x, 1.7], N[(N[(1.0 + N[(x * -1.3333333333333333), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.7:\\
\;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\

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


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

    1. Initial program 92.6%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left({x}^{2} \cdot \left(1 - 4 \cdot \frac{1}{x}\right)\right)}, \mathsf{*.f64}\left(y, 3\right)\right) \]
    4. Step-by-step derivation
      1. sub-negN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \frac{{x}^{2}}{x}\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      8. unpow2N/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot \frac{x}{x}\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      10. *-rgt-identityN/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot \left(x \cdot \frac{1}{x}\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      12. rgt-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot \left(x \cdot 1\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      13. *-rgt-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot {x}^{2} + -4 \cdot x\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\left({x}^{2} + -4 \cdot x\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      15. unpow2N/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot \left(x + \left(\mathsf{neg}\left(4\right)\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      18. sub-negN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x - 4\right)\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
      20. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x + \left(\mathsf{neg}\left(4\right)\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      21. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x + -4\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      22. +-lowering-+.f6491.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(x, -4\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
    5. Simplified91.1%

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

        \[\leadsto \frac{\left(x + -4\right) \cdot x}{\color{blue}{y} \cdot 3} \]
      2. times-fracN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -4\right), y\right), \mathsf{/.f64}\left(x, \color{blue}{3}\right)\right) \]
    7. Applied egg-rr98.2%

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

    if -1.75 < x < 1.69999999999999996

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\left(\mathsf{neg}\left(\frac{4}{3}\right)\right) \cdot \frac{1}{y}\right) + \frac{1}{y} \]
      8. metadata-evalN/A

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

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

        \[\leadsto \left(\frac{-4}{3} \cdot x\right) \cdot \frac{1}{y} + \frac{1}{y} \]
      11. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.75:\\ \;\;\;\;\frac{x}{3} \cdot \frac{x + -4}{y}\\ \mathbf{elif}\;x \leq 1.7:\\ \;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{3} \cdot \frac{x + -4}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 98.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x}{y} \cdot \left(-1.3333333333333333 + x \cdot 0.3333333333333333\right)\\
\mathbf{if}\;x \leq -1.75:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.7:\\
\;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\

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


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

    1. Initial program 92.6%

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

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

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

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

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

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

        \[\leadsto \frac{1}{3} \cdot \frac{{x}^{2}}{y} + \left(\mathsf{neg}\left(\frac{4}{3} \cdot \frac{1}{x \cdot y}\right)\right) \cdot {x}^{2} \]
      6. unpow2N/A

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

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

        \[\leadsto \left(\frac{1}{3} \cdot x\right) \cdot \frac{x}{y} + \color{blue}{\left(\mathsf{neg}\left(\frac{4}{3} \cdot \frac{1}{x \cdot y}\right)\right)} \cdot {x}^{2} \]
      9. associate-*r/N/A

        \[\leadsto \left(\frac{1}{3} \cdot x\right) \cdot \frac{x}{y} + \left(\mathsf{neg}\left(\frac{\frac{4}{3} \cdot 1}{x \cdot y}\right)\right) \cdot {x}^{2} \]
      10. metadata-evalN/A

        \[\leadsto \left(\frac{1}{3} \cdot x\right) \cdot \frac{x}{y} + \left(\mathsf{neg}\left(\frac{\frac{4}{3}}{x \cdot y}\right)\right) \cdot {x}^{2} \]
      11. distribute-neg-fracN/A

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

        \[\leadsto \left(\frac{1}{3} \cdot x\right) \cdot \frac{x}{y} + \frac{\frac{-4}{3}}{x \cdot y} \cdot {x}^{2} \]
      13. associate-*l/N/A

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

        \[\leadsto \left(\frac{1}{3} \cdot x\right) \cdot \frac{x}{y} + \frac{\frac{-4}{3} \cdot {x}^{2}}{y \cdot \color{blue}{x}} \]
      15. times-fracN/A

        \[\leadsto \left(\frac{1}{3} \cdot x\right) \cdot \frac{x}{y} + \frac{\frac{-4}{3}}{y} \cdot \color{blue}{\frac{{x}^{2}}{x}} \]
      16. unpow2N/A

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

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

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

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

    if -1.75 < x < 1.69999999999999996

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\left(\mathsf{neg}\left(\frac{4}{3}\right)\right) \cdot \frac{1}{y}\right) + \frac{1}{y} \]
      8. metadata-evalN/A

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

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

        \[\leadsto \left(\frac{-4}{3} \cdot x\right) \cdot \frac{1}{y} + \frac{1}{y} \]
      11. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 98.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6:\\
\;\;\;\;\frac{\frac{x}{3}}{\frac{y}{x}}\\

\mathbf{elif}\;x \leq 3:\\
\;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\

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


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

    1. Initial program 93.6%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
      2. *-lowering-*.f6489.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
    5. Simplified89.6%

      \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 3} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{x \cdot x}{3 \cdot \color{blue}{y}} \]
      2. times-fracN/A

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

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

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

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

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

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

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

    if -4.5999999999999996 < x < 3

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\left(\mathsf{neg}\left(\frac{4}{3}\right)\right) \cdot \frac{1}{y}\right) + \frac{1}{y} \]
      8. metadata-evalN/A

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

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

        \[\leadsto \left(\frac{-4}{3} \cdot x\right) \cdot \frac{1}{y} + \frac{1}{y} \]
      11. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3 < x

    1. Initial program 91.6%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
      2. *-lowering-*.f6487.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
    5. Simplified87.6%

      \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 3} \]
    6. Step-by-step derivation
      1. times-fracN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\frac{x}{y}\right), x\right), 3\right) \]
      5. /-lowering-/.f6495.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), x\right), 3\right) \]
    7. Applied egg-rr95.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.6:\\ \;\;\;\;\frac{\frac{x}{3}}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq 3:\\ \;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 98.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x \cdot \frac{x}{y}}{3}\\
\mathbf{if}\;x \leq -4.6:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 3:\\
\;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\

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


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

    1. Initial program 92.6%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
      2. *-lowering-*.f6488.7%

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

      \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 3} \]
    6. Step-by-step derivation
      1. times-fracN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\frac{x}{y}\right), x\right), 3\right) \]
      5. /-lowering-/.f6495.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), x\right), 3\right) \]
    7. Applied egg-rr95.7%

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

    if -4.5999999999999996 < x < 3

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\left(\mathsf{neg}\left(\frac{4}{3}\right)\right) \cdot \frac{1}{y}\right) + \frac{1}{y} \]
      8. metadata-evalN/A

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

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

        \[\leadsto \left(\frac{-4}{3} \cdot x\right) \cdot \frac{1}{y} + \frac{1}{y} \]
      11. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.6:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{3}\\ \mathbf{elif}\;x \leq 3:\\ \;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 97.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x \cdot \frac{x}{y}}{3}\\
\mathbf{if}\;x \leq -1.75:\\
\;\;\;\;t\_0\\

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

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


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

    1. Initial program 92.6%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
      2. *-lowering-*.f6488.7%

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

      \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 3} \]
    6. Step-by-step derivation
      1. times-fracN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\frac{x}{y}\right), x\right), 3\right) \]
      5. /-lowering-/.f6495.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), x\right), 3\right) \]
    7. Applied egg-rr95.7%

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

    if -1.75 < x < 5.20000000000000018

    1. Initial program 99.7%

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

      \[\leadsto \color{blue}{\frac{1}{y}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f6498.4%

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{y}\right) \]
    5. Simplified98.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.75:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{3}\\ \mathbf{elif}\;x \leq 5.2:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 97.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75:\\
\;\;\;\;0.3333333333333333 \cdot \frac{x}{\frac{y}{x}}\\

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

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


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

    1. Initial program 93.6%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
      2. *-lowering-*.f6489.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(\color{blue}{y}, 3\right)\right) \]
    5. Simplified89.6%

      \[\leadsto \frac{\color{blue}{x \cdot x}}{y \cdot 3} \]
    6. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(x \cdot \frac{1}{\frac{y}{x}}\right), \left(\frac{1}{3}\right)\right) \]
      6. un-div-invN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, x\right)\right), \left(\frac{1}{3}\right)\right) \]
      9. metadata-eval95.7%

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

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

    if -1.75 < x < 5.20000000000000018

    1. Initial program 99.7%

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

      \[\leadsto \color{blue}{\frac{1}{y}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f6498.4%

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{y}\right) \]
    5. Simplified98.4%

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

    if 5.20000000000000018 < x

    1. Initial program 91.6%

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

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{{x}^{2}}{y}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{3} \cdot {x}^{2}\right), \color{blue}{y}\right) \]
      3. unpow2N/A

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{3}\right)\right), y\right) \]
    5. Simplified87.6%

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

        \[\leadsto \frac{x \cdot \left(x \cdot \frac{1}{3}\right)}{y} \]
      2. div-invN/A

        \[\leadsto \frac{x \cdot \frac{x}{3}}{y} \]
      3. *-commutativeN/A

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

        \[\leadsto \frac{\frac{x}{3}}{y} \cdot \color{blue}{x} \]
      5. *-lowering-*.f64N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, \left(y \cdot 3\right)\right), x\right) \]
      8. metadata-evalN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{y}{\frac{1}{3}}\right)\right), x\right) \]
      10. /-lowering-/.f6495.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, \frac{1}{3}\right)\right), x\right) \]
    7. Applied egg-rr95.5%

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{0.3333333333333333}} \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.75:\\ \;\;\;\;0.3333333333333333 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq 5.2:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{x}{\frac{y}{0.3333333333333333}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 97.7% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \frac{x}{\frac{y}{0.3333333333333333}}\\
\mathbf{if}\;x \leq -1.75:\\
\;\;\;\;t\_0\\

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

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


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

    1. Initial program 92.6%

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

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{{x}^{2}}{y}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{3} \cdot {x}^{2}\right), \color{blue}{y}\right) \]
      3. unpow2N/A

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{3}\right)\right), y\right) \]
    5. Simplified88.6%

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

        \[\leadsto \frac{x \cdot \left(x \cdot \frac{1}{3}\right)}{y} \]
      2. div-invN/A

        \[\leadsto \frac{x \cdot \frac{x}{3}}{y} \]
      3. *-commutativeN/A

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

        \[\leadsto \frac{\frac{x}{3}}{y} \cdot \color{blue}{x} \]
      5. *-lowering-*.f64N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, \left(y \cdot 3\right)\right), x\right) \]
      8. metadata-evalN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{y}{\frac{1}{3}}\right)\right), x\right) \]
      10. /-lowering-/.f6495.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, \frac{1}{3}\right)\right), x\right) \]
    7. Applied egg-rr95.5%

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

    if -1.75 < x < 5.20000000000000018

    1. Initial program 99.7%

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

      \[\leadsto \color{blue}{\frac{1}{y}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f6498.4%

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{y}\right) \]
    5. Simplified98.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.75:\\ \;\;\;\;x \cdot \frac{x}{\frac{y}{0.3333333333333333}}\\ \mathbf{elif}\;x \leq 5.2:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{x}{\frac{y}{0.3333333333333333}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 99.6% accurate, 1.0× speedup?

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

\\
\frac{\frac{3 - x}{y}}{\frac{3}{1 - x}}
\end{array}
Derivation
  1. Initial program 96.4%

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

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

      \[\leadsto \frac{1}{\frac{y \cdot 3}{\left(3 - x\right) \cdot \color{blue}{\left(1 - x\right)}}} \]
    3. times-fracN/A

      \[\leadsto \frac{1}{\frac{y}{3 - x} \cdot \color{blue}{\frac{3}{1 - x}}} \]
    4. associate-/r*N/A

      \[\leadsto \frac{\frac{1}{\frac{y}{3 - x}}}{\color{blue}{\frac{3}{1 - x}}} \]
    5. clear-numN/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(3, x\right), y\right), \mathsf{/.f64}\left(3, \mathsf{\_.f64}\left(1, \color{blue}{x}\right)\right)\right) \]
  4. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{\frac{3 - x}{y}}{\frac{3}{1 - x}}} \]
  5. Add Preprocessing

Alternative 13: 99.6% accurate, 1.0× speedup?

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

\\
\frac{0.3333333333333333 - \frac{x}{3}}{\frac{y}{3 - x}}
\end{array}
Derivation
  1. Initial program 96.4%

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

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

      \[\leadsto \frac{1}{\frac{3 \cdot y}{\color{blue}{\left(1 - x\right)} \cdot \left(3 - x\right)}} \]
    3. times-fracN/A

      \[\leadsto \frac{1}{\frac{3}{1 - x} \cdot \color{blue}{\frac{y}{3 - x}}} \]
    4. associate-/r*N/A

      \[\leadsto \frac{\frac{1}{\frac{3}{1 - x}}}{\color{blue}{\frac{y}{3 - x}}} \]
    5. clear-numN/A

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

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{1 - x}{3}\right), \color{blue}{\left(\frac{y}{3 - x}\right)}\right) \]
    7. div-subN/A

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\frac{1}{3}, \mathsf{/.f64}\left(x, 3\right)\right), \mathsf{/.f64}\left(y, \color{blue}{\left(3 - x\right)}\right)\right) \]
    12. --lowering--.f6499.6%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\frac{1}{3}, \mathsf{/.f64}\left(x, 3\right)\right), \mathsf{/.f64}\left(y, \mathsf{\_.f64}\left(3, \color{blue}{x}\right)\right)\right) \]
  4. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{0.3333333333333333 - \frac{x}{3}}{\frac{y}{3 - x}}} \]
  5. Add Preprocessing

Alternative 14: 57.1% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.75:\\ \;\;\;\;\frac{x}{y} \cdot -1.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -0.75) (* (/ x y) -1.3333333333333333) (/ 1.0 y)))
double code(double x, double y) {
	double tmp;
	if (x <= -0.75) {
		tmp = (x / y) * -1.3333333333333333;
	} else {
		tmp = 1.0 / y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-0.75d0)) then
        tmp = (x / y) * (-1.3333333333333333d0)
    else
        tmp = 1.0d0 / y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -0.75) {
		tmp = (x / y) * -1.3333333333333333;
	} else {
		tmp = 1.0 / y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -0.75:
		tmp = (x / y) * -1.3333333333333333
	else:
		tmp = 1.0 / y
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -0.75)
		tmp = Float64(Float64(x / y) * -1.3333333333333333);
	else
		tmp = Float64(1.0 / y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -0.75)
		tmp = (x / y) * -1.3333333333333333;
	else
		tmp = 1.0 / y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -0.75], N[(N[(x / y), $MachinePrecision] * -1.3333333333333333), $MachinePrecision], N[(1.0 / y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.75:\\
\;\;\;\;\frac{x}{y} \cdot -1.3333333333333333\\

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


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

    1. Initial program 93.6%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(3 + -4 \cdot \left(x \cdot 1\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      2. rgt-mult-inverseN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(3 + -4 \cdot \frac{x \cdot x}{x}\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\left(3 + -4 \cdot \frac{{x}^{2}}{x}\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      7. *-lft-identityN/A

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(3 + {x}^{2} \cdot \left(\mathsf{neg}\left(4 \cdot \frac{1}{x}\right)\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
      13. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(3, \left(\left({x}^{2} \cdot \frac{1}{x}\right) \cdot -4\right)\right), \mathsf{*.f64}\left(y, 3\right)\right) \]
    5. Simplified25.0%

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

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

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

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

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

    if -0.75 < x

    1. Initial program 97.3%

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

      \[\leadsto \color{blue}{\frac{1}{y}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f6471.0%

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{y}\right) \]
    5. Simplified71.0%

      \[\leadsto \color{blue}{\frac{1}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.75:\\ \;\;\;\;\frac{x}{y} \cdot -1.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 51.0% accurate, 3.7× speedup?

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

\\
\frac{1}{y}
\end{array}
Derivation
  1. Initial program 96.4%

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{y}\right) \]
  5. Simplified55.2%

    \[\leadsto \color{blue}{\frac{1}{y}} \]
  6. Add Preprocessing

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

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

\\
\frac{1 - x}{y} \cdot \frac{3 - x}{3}
\end{array}

Reproduce

?
herbie shell --seed 2024163 
(FPCore (x y)
  :name "Diagrams.TwoD.Arc:bezierFromSweepQ1 from diagrams-lib-1.3.0.3"
  :precision binary64

  :alt
  (! :herbie-platform default (* (/ (- 1 x) y) (/ (- 3 x) 3)))

  (/ (* (- 1.0 x) (- 3.0 x)) (* y 3.0)))