Data.Approximate.Numerics:blog from approximate-0.2.2.1

Percentage Accurate: 99.7% → 99.9%
Time: 10.8s
Alternatives: 11
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))
double code(double x) {
	return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (6.0d0 * (x - 1.0d0)) / ((x + 1.0d0) + (4.0d0 * sqrt(x)))
end function
public static double code(double x) {
	return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * Math.sqrt(x)));
}
def code(x):
	return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * math.sqrt(x)))
function code(x)
	return Float64(Float64(6.0 * Float64(x - 1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x))))
end
function tmp = code(x)
	tmp = (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)));
end
code[x_] := N[(N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))
double code(double x) {
	return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (6.0d0 * (x - 1.0d0)) / ((x + 1.0d0) + (4.0d0 * sqrt(x)))
end function
public static double code(double x) {
	return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * Math.sqrt(x)));
}
def code(x):
	return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * math.sqrt(x)))
function code(x)
	return Float64(Float64(6.0 * Float64(x - 1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x))))
end
function tmp = code(x)
	tmp = (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)));
end
code[x_] := N[(N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
\end{array}

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x + -1}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \cdot 6 \end{array} \]
(FPCore (x)
 :precision binary64
 (* (/ (+ x -1.0) (+ (+ x 1.0) (* 4.0 (sqrt x)))) 6.0))
double code(double x) {
	return ((x + -1.0) / ((x + 1.0) + (4.0 * sqrt(x)))) * 6.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((x + (-1.0d0)) / ((x + 1.0d0) + (4.0d0 * sqrt(x)))) * 6.0d0
end function
public static double code(double x) {
	return ((x + -1.0) / ((x + 1.0) + (4.0 * Math.sqrt(x)))) * 6.0;
}
def code(x):
	return ((x + -1.0) / ((x + 1.0) + (4.0 * math.sqrt(x)))) * 6.0
function code(x)
	return Float64(Float64(Float64(x + -1.0) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) * 6.0)
end
function tmp = code(x)
	tmp = ((x + -1.0) / ((x + 1.0) + (4.0 * sqrt(x)))) * 6.0;
end
code[x_] := N[(N[(N[(x + -1.0), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 6.0), $MachinePrecision]
\begin{array}{l}

\\
\frac{x + -1}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \cdot 6
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/l*N/A

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(x - 1\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
    5. sub-negN/A

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(1\right)\right)\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
    7. metadata-evalN/A

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{x + -1}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \cdot 6} \]
  5. Add Preprocessing

Alternative 2: 97.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{\left(x + -1\right) \cdot 6}{1 - \sqrt{x} \cdot -4}\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \frac{x + -1}{x + 4 \cdot \sqrt{x}}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 1.0)
   (/ (* (+ x -1.0) 6.0) (- 1.0 (* (sqrt x) -4.0)))
   (* 6.0 (/ (+ x -1.0) (+ x (* 4.0 (sqrt x)))))))
double code(double x) {
	double tmp;
	if (x <= 1.0) {
		tmp = ((x + -1.0) * 6.0) / (1.0 - (sqrt(x) * -4.0));
	} else {
		tmp = 6.0 * ((x + -1.0) / (x + (4.0 * sqrt(x))));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 1.0d0) then
        tmp = ((x + (-1.0d0)) * 6.0d0) / (1.0d0 - (sqrt(x) * (-4.0d0)))
    else
        tmp = 6.0d0 * ((x + (-1.0d0)) / (x + (4.0d0 * sqrt(x))))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 1.0) {
		tmp = ((x + -1.0) * 6.0) / (1.0 - (Math.sqrt(x) * -4.0));
	} else {
		tmp = 6.0 * ((x + -1.0) / (x + (4.0 * Math.sqrt(x))));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 1.0:
		tmp = ((x + -1.0) * 6.0) / (1.0 - (math.sqrt(x) * -4.0))
	else:
		tmp = 6.0 * ((x + -1.0) / (x + (4.0 * math.sqrt(x))))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 1.0)
		tmp = Float64(Float64(Float64(x + -1.0) * 6.0) / Float64(1.0 - Float64(sqrt(x) * -4.0)));
	else
		tmp = Float64(6.0 * Float64(Float64(x + -1.0) / Float64(x + Float64(4.0 * sqrt(x)))));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 1.0)
		tmp = ((x + -1.0) * 6.0) / (1.0 - (sqrt(x) * -4.0));
	else
		tmp = 6.0 * ((x + -1.0) / (x + (4.0 * sqrt(x))));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 1.0], N[(N[(N[(x + -1.0), $MachinePrecision] * 6.0), $MachinePrecision] / N[(1.0 - N[(N[Sqrt[x], $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(N[(x + -1.0), $MachinePrecision] / N[(x + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{\left(x + -1\right) \cdot 6}{1 - \sqrt{x} \cdot -4}\\

\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{x + -1}{x + 4 \cdot \sqrt{x}}\\


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

    1. Initial program 99.9%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(6, \mathsf{\_.f64}\left(x, 1\right)\right), \color{blue}{\left(1 + 4 \cdot \sqrt{x}\right)}\right) \]
    4. Step-by-step derivation
      1. metadata-evalN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(6, \mathsf{\_.f64}\left(x, 1\right)\right), \left(1 - \color{blue}{-4 \cdot \sqrt{x}}\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(6, \mathsf{\_.f64}\left(x, 1\right)\right), \mathsf{\_.f64}\left(1, \color{blue}{\left(-4 \cdot \sqrt{x}\right)}\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(6, \mathsf{\_.f64}\left(x, 1\right)\right), \mathsf{\_.f64}\left(1, \left(\sqrt{x} \cdot \color{blue}{-4}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(6, \mathsf{\_.f64}\left(x, 1\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{-4}\right)\right)\right) \]
      7. sqrt-lowering-sqrt.f6498.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(6, \mathsf{\_.f64}\left(x, 1\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), -4\right)\right)\right) \]
    5. Simplified98.8%

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

    if 1 < x

    1. Initial program 99.6%

      \[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/l*N/A

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(x - 1\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
      5. sub-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(1\right)\right)\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
      7. metadata-evalN/A

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

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

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

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

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

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

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

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

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

    Alternative 3: 97.6% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{x + -1}{0.16666666666666666 + \sqrt{x} \cdot 0.6666666666666666}\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \frac{x + -1}{x + 4 \cdot \sqrt{x}}\\ \end{array} \end{array} \]
    (FPCore (x)
     :precision binary64
     (if (<= x 1.0)
       (/ (+ x -1.0) (+ 0.16666666666666666 (* (sqrt x) 0.6666666666666666)))
       (* 6.0 (/ (+ x -1.0) (+ x (* 4.0 (sqrt x)))))))
    double code(double x) {
    	double tmp;
    	if (x <= 1.0) {
    		tmp = (x + -1.0) / (0.16666666666666666 + (sqrt(x) * 0.6666666666666666));
    	} else {
    		tmp = 6.0 * ((x + -1.0) / (x + (4.0 * sqrt(x))));
    	}
    	return tmp;
    }
    
    real(8) function code(x)
        real(8), intent (in) :: x
        real(8) :: tmp
        if (x <= 1.0d0) then
            tmp = (x + (-1.0d0)) / (0.16666666666666666d0 + (sqrt(x) * 0.6666666666666666d0))
        else
            tmp = 6.0d0 * ((x + (-1.0d0)) / (x + (4.0d0 * sqrt(x))))
        end if
        code = tmp
    end function
    
    public static double code(double x) {
    	double tmp;
    	if (x <= 1.0) {
    		tmp = (x + -1.0) / (0.16666666666666666 + (Math.sqrt(x) * 0.6666666666666666));
    	} else {
    		tmp = 6.0 * ((x + -1.0) / (x + (4.0 * Math.sqrt(x))));
    	}
    	return tmp;
    }
    
    def code(x):
    	tmp = 0
    	if x <= 1.0:
    		tmp = (x + -1.0) / (0.16666666666666666 + (math.sqrt(x) * 0.6666666666666666))
    	else:
    		tmp = 6.0 * ((x + -1.0) / (x + (4.0 * math.sqrt(x))))
    	return tmp
    
    function code(x)
    	tmp = 0.0
    	if (x <= 1.0)
    		tmp = Float64(Float64(x + -1.0) / Float64(0.16666666666666666 + Float64(sqrt(x) * 0.6666666666666666)));
    	else
    		tmp = Float64(6.0 * Float64(Float64(x + -1.0) / Float64(x + Float64(4.0 * sqrt(x)))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x)
    	tmp = 0.0;
    	if (x <= 1.0)
    		tmp = (x + -1.0) / (0.16666666666666666 + (sqrt(x) * 0.6666666666666666));
    	else
    		tmp = 6.0 * ((x + -1.0) / (x + (4.0 * sqrt(x))));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_] := If[LessEqual[x, 1.0], N[(N[(x + -1.0), $MachinePrecision] / N[(0.16666666666666666 + N[(N[Sqrt[x], $MachinePrecision] * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(N[(x + -1.0), $MachinePrecision] / N[(x + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 1:\\
    \;\;\;\;\frac{x + -1}{0.16666666666666666 + \sqrt{x} \cdot 0.6666666666666666}\\
    
    \mathbf{else}:\\
    \;\;\;\;6 \cdot \frac{x + -1}{x + 4 \cdot \sqrt{x}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 1

      1. Initial program 99.9%

        \[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-/l*N/A

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(x - 1\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
        5. sub-negN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(1\right)\right)\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
        7. metadata-evalN/A

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \left(\sqrt{x}\right)\right)\right)\right), 6\right) \]
        11. sqrt-lowering-sqrt.f64100.0%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right), 6\right) \]
      4. Applied egg-rr100.0%

        \[\leadsto \color{blue}{\frac{x + -1}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \cdot 6} \]
      5. Step-by-step derivation
        1. associate-*l/N/A

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{/.f64}\left(\left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right), \color{blue}{6}\right)\right) \]
        8. associate-+l+N/A

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x + -1}{\frac{x + \left(1 + 4 \cdot \sqrt{x}\right)}{6}}} \]
      7. Taylor expanded in x around 0

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \color{blue}{\left(\frac{1}{6} \cdot \left(1 + 4 \cdot \sqrt{x}\right)\right)}\right) \]
      8. Step-by-step derivation
        1. distribute-rgt-inN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \left(1 \cdot \frac{1}{6} + \color{blue}{\left(4 \cdot \sqrt{x}\right) \cdot \frac{1}{6}}\right)\right) \]
        2. metadata-evalN/A

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \left(\color{blue}{\frac{1}{6}} \cdot 4\right)\right)\right)\right) \]
        9. metadata-eval98.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \frac{2}{3}\right)\right)\right) \]
      9. Simplified98.8%

        \[\leadsto \frac{x + -1}{\color{blue}{0.16666666666666666 + \sqrt{x} \cdot 0.6666666666666666}} \]

      if 1 < x

      1. Initial program 99.6%

        \[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-/l*N/A

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(x - 1\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
        5. sub-negN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(1\right)\right)\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
        7. metadata-evalN/A

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{x + -1}{0.16666666666666666 + \sqrt{x} \cdot 0.6666666666666666}\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \frac{x + -1}{x + 4 \cdot \sqrt{x}}\\ \end{array} \]
      9. Add Preprocessing

      Alternative 4: 97.5% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{x + -1}{0.16666666666666666 + \sqrt{x} \cdot 0.6666666666666666}\\ \mathbf{else}:\\ \;\;\;\;\left(x + -1\right) \cdot \frac{6}{x + 4 \cdot \sqrt{x}}\\ \end{array} \end{array} \]
      (FPCore (x)
       :precision binary64
       (if (<= x 1.0)
         (/ (+ x -1.0) (+ 0.16666666666666666 (* (sqrt x) 0.6666666666666666)))
         (* (+ x -1.0) (/ 6.0 (+ x (* 4.0 (sqrt x)))))))
      double code(double x) {
      	double tmp;
      	if (x <= 1.0) {
      		tmp = (x + -1.0) / (0.16666666666666666 + (sqrt(x) * 0.6666666666666666));
      	} else {
      		tmp = (x + -1.0) * (6.0 / (x + (4.0 * sqrt(x))));
      	}
      	return tmp;
      }
      
      real(8) function code(x)
          real(8), intent (in) :: x
          real(8) :: tmp
          if (x <= 1.0d0) then
              tmp = (x + (-1.0d0)) / (0.16666666666666666d0 + (sqrt(x) * 0.6666666666666666d0))
          else
              tmp = (x + (-1.0d0)) * (6.0d0 / (x + (4.0d0 * sqrt(x))))
          end if
          code = tmp
      end function
      
      public static double code(double x) {
      	double tmp;
      	if (x <= 1.0) {
      		tmp = (x + -1.0) / (0.16666666666666666 + (Math.sqrt(x) * 0.6666666666666666));
      	} else {
      		tmp = (x + -1.0) * (6.0 / (x + (4.0 * Math.sqrt(x))));
      	}
      	return tmp;
      }
      
      def code(x):
      	tmp = 0
      	if x <= 1.0:
      		tmp = (x + -1.0) / (0.16666666666666666 + (math.sqrt(x) * 0.6666666666666666))
      	else:
      		tmp = (x + -1.0) * (6.0 / (x + (4.0 * math.sqrt(x))))
      	return tmp
      
      function code(x)
      	tmp = 0.0
      	if (x <= 1.0)
      		tmp = Float64(Float64(x + -1.0) / Float64(0.16666666666666666 + Float64(sqrt(x) * 0.6666666666666666)));
      	else
      		tmp = Float64(Float64(x + -1.0) * Float64(6.0 / Float64(x + Float64(4.0 * sqrt(x)))));
      	end
      	return tmp
      end
      
      function tmp_2 = code(x)
      	tmp = 0.0;
      	if (x <= 1.0)
      		tmp = (x + -1.0) / (0.16666666666666666 + (sqrt(x) * 0.6666666666666666));
      	else
      		tmp = (x + -1.0) * (6.0 / (x + (4.0 * sqrt(x))));
      	end
      	tmp_2 = tmp;
      end
      
      code[x_] := If[LessEqual[x, 1.0], N[(N[(x + -1.0), $MachinePrecision] / N[(0.16666666666666666 + N[(N[Sqrt[x], $MachinePrecision] * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + -1.0), $MachinePrecision] * N[(6.0 / N[(x + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq 1:\\
      \;\;\;\;\frac{x + -1}{0.16666666666666666 + \sqrt{x} \cdot 0.6666666666666666}\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(x + -1\right) \cdot \frac{6}{x + 4 \cdot \sqrt{x}}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < 1

        1. Initial program 99.9%

          \[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. associate-/l*N/A

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(x - 1\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
          5. sub-negN/A

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(1\right)\right)\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
          7. metadata-evalN/A

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \left(\sqrt{x}\right)\right)\right)\right), 6\right) \]
          11. sqrt-lowering-sqrt.f64100.0%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right), 6\right) \]
        4. Applied egg-rr100.0%

          \[\leadsto \color{blue}{\frac{x + -1}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \cdot 6} \]
        5. Step-by-step derivation
          1. associate-*l/N/A

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{/.f64}\left(\left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right), \color{blue}{6}\right)\right) \]
          8. associate-+l+N/A

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{x + -1}{\frac{x + \left(1 + 4 \cdot \sqrt{x}\right)}{6}}} \]
        7. Taylor expanded in x around 0

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \color{blue}{\left(\frac{1}{6} \cdot \left(1 + 4 \cdot \sqrt{x}\right)\right)}\right) \]
        8. Step-by-step derivation
          1. distribute-rgt-inN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \left(1 \cdot \frac{1}{6} + \color{blue}{\left(4 \cdot \sqrt{x}\right) \cdot \frac{1}{6}}\right)\right) \]
          2. metadata-evalN/A

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \left(\color{blue}{\frac{1}{6}} \cdot 4\right)\right)\right)\right) \]
          9. metadata-eval98.8%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \frac{2}{3}\right)\right)\right) \]
        9. Simplified98.8%

          \[\leadsto \frac{x + -1}{\color{blue}{0.16666666666666666 + \sqrt{x} \cdot 0.6666666666666666}} \]

        if 1 < x

        1. Initial program 99.6%

          \[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. associate-/l*N/A

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(x - 1\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
          5. sub-negN/A

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(1\right)\right)\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
          7. metadata-evalN/A

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

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

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

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

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

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

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

            \[\leadsto \frac{x + -1}{\color{blue}{x} + 4 \cdot \sqrt{x}} \cdot 6 \]
          2. Step-by-step derivation
            1. *-commutativeN/A

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

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

              \[\leadsto 6 \cdot \left(\left(x + \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \frac{1}{x + 4 \cdot \sqrt{x}}\right) \]
            4. sub-negN/A

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(6, \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right), \left(x - 1\right)\right) \]
            13. sub-negN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(6, \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right), \left(x + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
            14. metadata-evalN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(6, \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right), \left(x + -1\right)\right) \]
            15. +-lowering-+.f6496.5%

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

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

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

        Alternative 5: 97.5% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4:\\ \;\;\;\;\frac{x + -1}{0.16666666666666666 + \sqrt{x} \cdot 0.6666666666666666}\\ \mathbf{else}:\\ \;\;\;\;\frac{6}{1 + \frac{4}{\sqrt{x}}}\\ \end{array} \end{array} \]
        (FPCore (x)
         :precision binary64
         (if (<= x 4.0)
           (/ (+ x -1.0) (+ 0.16666666666666666 (* (sqrt x) 0.6666666666666666)))
           (/ 6.0 (+ 1.0 (/ 4.0 (sqrt x))))))
        double code(double x) {
        	double tmp;
        	if (x <= 4.0) {
        		tmp = (x + -1.0) / (0.16666666666666666 + (sqrt(x) * 0.6666666666666666));
        	} else {
        		tmp = 6.0 / (1.0 + (4.0 / sqrt(x)));
        	}
        	return tmp;
        }
        
        real(8) function code(x)
            real(8), intent (in) :: x
            real(8) :: tmp
            if (x <= 4.0d0) then
                tmp = (x + (-1.0d0)) / (0.16666666666666666d0 + (sqrt(x) * 0.6666666666666666d0))
            else
                tmp = 6.0d0 / (1.0d0 + (4.0d0 / sqrt(x)))
            end if
            code = tmp
        end function
        
        public static double code(double x) {
        	double tmp;
        	if (x <= 4.0) {
        		tmp = (x + -1.0) / (0.16666666666666666 + (Math.sqrt(x) * 0.6666666666666666));
        	} else {
        		tmp = 6.0 / (1.0 + (4.0 / Math.sqrt(x)));
        	}
        	return tmp;
        }
        
        def code(x):
        	tmp = 0
        	if x <= 4.0:
        		tmp = (x + -1.0) / (0.16666666666666666 + (math.sqrt(x) * 0.6666666666666666))
        	else:
        		tmp = 6.0 / (1.0 + (4.0 / math.sqrt(x)))
        	return tmp
        
        function code(x)
        	tmp = 0.0
        	if (x <= 4.0)
        		tmp = Float64(Float64(x + -1.0) / Float64(0.16666666666666666 + Float64(sqrt(x) * 0.6666666666666666)));
        	else
        		tmp = Float64(6.0 / Float64(1.0 + Float64(4.0 / sqrt(x))));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x)
        	tmp = 0.0;
        	if (x <= 4.0)
        		tmp = (x + -1.0) / (0.16666666666666666 + (sqrt(x) * 0.6666666666666666));
        	else
        		tmp = 6.0 / (1.0 + (4.0 / sqrt(x)));
        	end
        	tmp_2 = tmp;
        end
        
        code[x_] := If[LessEqual[x, 4.0], N[(N[(x + -1.0), $MachinePrecision] / N[(0.16666666666666666 + N[(N[Sqrt[x], $MachinePrecision] * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(1.0 + N[(4.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;x \leq 4:\\
        \;\;\;\;\frac{x + -1}{0.16666666666666666 + \sqrt{x} \cdot 0.6666666666666666}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{6}{1 + \frac{4}{\sqrt{x}}}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < 4

          1. Initial program 99.9%

            \[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. associate-/l*N/A

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

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(x - 1\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
            5. sub-negN/A

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(1\right)\right)\right), \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)\right), 6\right) \]
            7. metadata-evalN/A

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

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \left(\sqrt{x}\right)\right)\right)\right), 6\right) \]
            11. sqrt-lowering-sqrt.f64100.0%

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right), 6\right) \]
          4. Applied egg-rr100.0%

            \[\leadsto \color{blue}{\frac{x + -1}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \cdot 6} \]
          5. Step-by-step derivation
            1. associate-*l/N/A

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

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{/.f64}\left(\left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right), \color{blue}{6}\right)\right) \]
            8. associate-+l+N/A

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

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

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

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

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

            \[\leadsto \color{blue}{\frac{x + -1}{\frac{x + \left(1 + 4 \cdot \sqrt{x}\right)}{6}}} \]
          7. Taylor expanded in x around 0

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \color{blue}{\left(\frac{1}{6} \cdot \left(1 + 4 \cdot \sqrt{x}\right)\right)}\right) \]
          8. Step-by-step derivation
            1. distribute-rgt-inN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \left(1 \cdot \frac{1}{6} + \color{blue}{\left(4 \cdot \sqrt{x}\right) \cdot \frac{1}{6}}\right)\right) \]
            2. metadata-evalN/A

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

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \left(\color{blue}{\frac{1}{6}} \cdot 4\right)\right)\right)\right) \]
            9. metadata-eval98.8%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{+.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \frac{2}{3}\right)\right)\right) \]
          9. Simplified98.8%

            \[\leadsto \frac{x + -1}{\color{blue}{0.16666666666666666 + \sqrt{x} \cdot 0.6666666666666666}} \]

          if 4 < x

          1. Initial program 99.6%

            \[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. associate-/l*N/A

              \[\leadsto 6 \cdot \color{blue}{\frac{x - 1}{\left(x + 1\right) + 4 \cdot \sqrt{x}}} \]
            2. clear-numN/A

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

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

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(6, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right), \left(x - 1\right)\right)\right) \]
            10. sub-negN/A

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

              \[\leadsto \mathsf{/.f64}\left(6, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right), \mathsf{+.f64}\left(x, \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right)\right) \]
            12. metadata-eval99.9%

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

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right)\right)\right)\right) \]
          7. Simplified96.5%

            \[\leadsto \frac{6}{\color{blue}{1 + 4 \cdot \sqrt{\frac{1}{x}}}} \]
          8. Step-by-step derivation
            1. +-commutativeN/A

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

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

              \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(\left(4 \cdot \frac{\sqrt{1}}{\sqrt{x}}\right), 1\right)\right) \]
            4. metadata-evalN/A

              \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(\left(4 \cdot \frac{1}{\sqrt{x}}\right), 1\right)\right) \]
            5. un-div-invN/A

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

              \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(\mathsf{/.f64}\left(4, \left(\sqrt{x}\right)\right), 1\right)\right) \]
            7. sqrt-lowering-sqrt.f6496.5%

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4:\\ \;\;\;\;\frac{x + -1}{0.16666666666666666 + \sqrt{x} \cdot 0.6666666666666666}\\ \mathbf{else}:\\ \;\;\;\;\frac{6}{1 + \frac{4}{\sqrt{x}}}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 6: 97.5% accurate, 1.0× speedup?

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

          1. Initial program 99.9%

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

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

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

            if 1 < x

            1. Initial program 99.6%

              \[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. associate-/l*N/A

                \[\leadsto 6 \cdot \color{blue}{\frac{x - 1}{\left(x + 1\right) + 4 \cdot \sqrt{x}}} \]
              2. clear-numN/A

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

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

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

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

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

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

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

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right), \left(x - 1\right)\right)\right) \]
              10. sub-negN/A

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

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right), \mathsf{+.f64}\left(x, \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right)\right) \]
              12. metadata-eval99.9%

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

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

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

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

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

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

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right)\right)\right)\right) \]
            7. Simplified96.5%

              \[\leadsto \frac{6}{\color{blue}{1 + 4 \cdot \sqrt{\frac{1}{x}}}} \]
            8. Step-by-step derivation
              1. +-commutativeN/A

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

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

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(\left(4 \cdot \frac{\sqrt{1}}{\sqrt{x}}\right), 1\right)\right) \]
              4. metadata-evalN/A

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(\left(4 \cdot \frac{1}{\sqrt{x}}\right), 1\right)\right) \]
              5. un-div-invN/A

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

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(\mathsf{/.f64}\left(4, \left(\sqrt{x}\right)\right), 1\right)\right) \]
              7. sqrt-lowering-sqrt.f6496.5%

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

              \[\leadsto \frac{6}{\color{blue}{\frac{4}{\sqrt{x}} + 1}} \]
          5. Recombined 2 regimes into one program.
          6. Final simplification97.6%

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

          Alternative 7: 99.9% accurate, 1.0× speedup?

          \[\begin{array}{l} \\ \left(x + -1\right) \cdot \frac{6}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \end{array} \]
          (FPCore (x)
           :precision binary64
           (* (+ x -1.0) (/ 6.0 (+ (+ x 1.0) (* 4.0 (sqrt x))))))
          double code(double x) {
          	return (x + -1.0) * (6.0 / ((x + 1.0) + (4.0 * sqrt(x))));
          }
          
          real(8) function code(x)
              real(8), intent (in) :: x
              code = (x + (-1.0d0)) * (6.0d0 / ((x + 1.0d0) + (4.0d0 * sqrt(x))))
          end function
          
          public static double code(double x) {
          	return (x + -1.0) * (6.0 / ((x + 1.0) + (4.0 * Math.sqrt(x))));
          }
          
          def code(x):
          	return (x + -1.0) * (6.0 / ((x + 1.0) + (4.0 * math.sqrt(x))))
          
          function code(x)
          	return Float64(Float64(x + -1.0) * Float64(6.0 / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))))
          end
          
          function tmp = code(x)
          	tmp = (x + -1.0) * (6.0 / ((x + 1.0) + (4.0 * sqrt(x))));
          end
          
          code[x_] := N[(N[(x + -1.0), $MachinePrecision] * N[(6.0 / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \left(x + -1\right) \cdot \frac{6}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
          \end{array}
          
          Derivation
          1. Initial program 99.8%

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

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

              \[\leadsto \frac{1}{\frac{\frac{\left(x + 1\right) + 4 \cdot \sqrt{x}}{6}}{\color{blue}{x - 1}}} \]
            3. associate-/r/N/A

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

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

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

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

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

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(6, \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right), \left(x - 1\right)\right) \]
            11. sub-negN/A

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(6, \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right), \mathsf{+.f64}\left(x, \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
            13. metadata-eval99.9%

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

            \[\leadsto \color{blue}{\frac{6}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \cdot \left(x + -1\right)} \]
          5. Final simplification99.9%

            \[\leadsto \left(x + -1\right) \cdot \frac{6}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \]
          6. Add Preprocessing

          Alternative 8: 97.5% accurate, 1.0× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{6}{-1 + \sqrt{x} \cdot -4}\\ \mathbf{else}:\\ \;\;\;\;\frac{6}{1 + \frac{4}{\sqrt{x}}}\\ \end{array} \end{array} \]
          (FPCore (x)
           :precision binary64
           (if (<= x 1.0)
             (/ 6.0 (+ -1.0 (* (sqrt x) -4.0)))
             (/ 6.0 (+ 1.0 (/ 4.0 (sqrt x))))))
          double code(double x) {
          	double tmp;
          	if (x <= 1.0) {
          		tmp = 6.0 / (-1.0 + (sqrt(x) * -4.0));
          	} else {
          		tmp = 6.0 / (1.0 + (4.0 / sqrt(x)));
          	}
          	return tmp;
          }
          
          real(8) function code(x)
              real(8), intent (in) :: x
              real(8) :: tmp
              if (x <= 1.0d0) then
                  tmp = 6.0d0 / ((-1.0d0) + (sqrt(x) * (-4.0d0)))
              else
                  tmp = 6.0d0 / (1.0d0 + (4.0d0 / sqrt(x)))
              end if
              code = tmp
          end function
          
          public static double code(double x) {
          	double tmp;
          	if (x <= 1.0) {
          		tmp = 6.0 / (-1.0 + (Math.sqrt(x) * -4.0));
          	} else {
          		tmp = 6.0 / (1.0 + (4.0 / Math.sqrt(x)));
          	}
          	return tmp;
          }
          
          def code(x):
          	tmp = 0
          	if x <= 1.0:
          		tmp = 6.0 / (-1.0 + (math.sqrt(x) * -4.0))
          	else:
          		tmp = 6.0 / (1.0 + (4.0 / math.sqrt(x)))
          	return tmp
          
          function code(x)
          	tmp = 0.0
          	if (x <= 1.0)
          		tmp = Float64(6.0 / Float64(-1.0 + Float64(sqrt(x) * -4.0)));
          	else
          		tmp = Float64(6.0 / Float64(1.0 + Float64(4.0 / sqrt(x))));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x)
          	tmp = 0.0;
          	if (x <= 1.0)
          		tmp = 6.0 / (-1.0 + (sqrt(x) * -4.0));
          	else
          		tmp = 6.0 / (1.0 + (4.0 / sqrt(x)));
          	end
          	tmp_2 = tmp;
          end
          
          code[x_] := If[LessEqual[x, 1.0], N[(6.0 / N[(-1.0 + N[(N[Sqrt[x], $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(1.0 + N[(4.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;x \leq 1:\\
          \;\;\;\;\frac{6}{-1 + \sqrt{x} \cdot -4}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{6}{1 + \frac{4}{\sqrt{x}}}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x < 1

            1. Initial program 99.9%

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

              \[\leadsto \color{blue}{\frac{-6}{1 + 4 \cdot \sqrt{x}}} \]
            4. Step-by-step derivation
              1. metadata-evalN/A

                \[\leadsto \frac{\mathsf{neg}\left(6\right)}{\color{blue}{1} + 4 \cdot \sqrt{x}} \]
              2. distribute-neg-fracN/A

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

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

                \[\leadsto \mathsf{/.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(\left(1 + 4 \cdot \sqrt{x}\right)\right)\right)}\right) \]
              5. distribute-neg-inN/A

                \[\leadsto \mathsf{/.f64}\left(6, \left(\left(\mathsf{neg}\left(1\right)\right) + \color{blue}{\left(\mathsf{neg}\left(4 \cdot \sqrt{x}\right)\right)}\right)\right) \]
              6. metadata-evalN/A

                \[\leadsto \mathsf{/.f64}\left(6, \left(-1 + \left(\mathsf{neg}\left(\color{blue}{4 \cdot \sqrt{x}}\right)\right)\right)\right) \]
              7. distribute-lft-neg-inN/A

                \[\leadsto \mathsf{/.f64}\left(6, \left(-1 + \left(\mathsf{neg}\left(4\right)\right) \cdot \color{blue}{\sqrt{x}}\right)\right) \]
              8. metadata-evalN/A

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

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

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

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{-4}\right)\right)\right) \]
              12. sqrt-lowering-sqrt.f6498.8%

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), -4\right)\right)\right) \]
            5. Simplified98.8%

              \[\leadsto \color{blue}{\frac{6}{-1 + \sqrt{x} \cdot -4}} \]

            if 1 < x

            1. Initial program 99.6%

              \[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. associate-/l*N/A

                \[\leadsto 6 \cdot \color{blue}{\frac{x - 1}{\left(x + 1\right) + 4 \cdot \sqrt{x}}} \]
              2. clear-numN/A

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

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

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

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

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

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

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

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right), \left(x - 1\right)\right)\right) \]
              10. sub-negN/A

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

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right), \mathsf{+.f64}\left(x, \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right)\right) \]
              12. metadata-eval99.9%

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

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

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

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

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

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

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right)\right)\right)\right) \]
            7. Simplified96.5%

              \[\leadsto \frac{6}{\color{blue}{1 + 4 \cdot \sqrt{\frac{1}{x}}}} \]
            8. Step-by-step derivation
              1. +-commutativeN/A

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

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

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(\left(4 \cdot \frac{\sqrt{1}}{\sqrt{x}}\right), 1\right)\right) \]
              4. metadata-evalN/A

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(\left(4 \cdot \frac{1}{\sqrt{x}}\right), 1\right)\right) \]
              5. un-div-invN/A

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

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(\mathsf{/.f64}\left(4, \left(\sqrt{x}\right)\right), 1\right)\right) \]
              7. sqrt-lowering-sqrt.f6496.5%

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

              \[\leadsto \frac{6}{\color{blue}{\frac{4}{\sqrt{x}} + 1}} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification97.5%

            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{6}{-1 + \sqrt{x} \cdot -4}\\ \mathbf{else}:\\ \;\;\;\;\frac{6}{1 + \frac{4}{\sqrt{x}}}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 9: 51.5% accurate, 1.0× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{6}{-1 + \sqrt{x} \cdot -4}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x} \cdot 1.5\\ \end{array} \end{array} \]
          (FPCore (x)
           :precision binary64
           (if (<= x 1.0) (/ 6.0 (+ -1.0 (* (sqrt x) -4.0))) (* (sqrt x) 1.5)))
          double code(double x) {
          	double tmp;
          	if (x <= 1.0) {
          		tmp = 6.0 / (-1.0 + (sqrt(x) * -4.0));
          	} else {
          		tmp = sqrt(x) * 1.5;
          	}
          	return tmp;
          }
          
          real(8) function code(x)
              real(8), intent (in) :: x
              real(8) :: tmp
              if (x <= 1.0d0) then
                  tmp = 6.0d0 / ((-1.0d0) + (sqrt(x) * (-4.0d0)))
              else
                  tmp = sqrt(x) * 1.5d0
              end if
              code = tmp
          end function
          
          public static double code(double x) {
          	double tmp;
          	if (x <= 1.0) {
          		tmp = 6.0 / (-1.0 + (Math.sqrt(x) * -4.0));
          	} else {
          		tmp = Math.sqrt(x) * 1.5;
          	}
          	return tmp;
          }
          
          def code(x):
          	tmp = 0
          	if x <= 1.0:
          		tmp = 6.0 / (-1.0 + (math.sqrt(x) * -4.0))
          	else:
          		tmp = math.sqrt(x) * 1.5
          	return tmp
          
          function code(x)
          	tmp = 0.0
          	if (x <= 1.0)
          		tmp = Float64(6.0 / Float64(-1.0 + Float64(sqrt(x) * -4.0)));
          	else
          		tmp = Float64(sqrt(x) * 1.5);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x)
          	tmp = 0.0;
          	if (x <= 1.0)
          		tmp = 6.0 / (-1.0 + (sqrt(x) * -4.0));
          	else
          		tmp = sqrt(x) * 1.5;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_] := If[LessEqual[x, 1.0], N[(6.0 / N[(-1.0 + N[(N[Sqrt[x], $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * 1.5), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;x \leq 1:\\
          \;\;\;\;\frac{6}{-1 + \sqrt{x} \cdot -4}\\
          
          \mathbf{else}:\\
          \;\;\;\;\sqrt{x} \cdot 1.5\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x < 1

            1. Initial program 99.9%

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

              \[\leadsto \color{blue}{\frac{-6}{1 + 4 \cdot \sqrt{x}}} \]
            4. Step-by-step derivation
              1. metadata-evalN/A

                \[\leadsto \frac{\mathsf{neg}\left(6\right)}{\color{blue}{1} + 4 \cdot \sqrt{x}} \]
              2. distribute-neg-fracN/A

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

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

                \[\leadsto \mathsf{/.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(\left(1 + 4 \cdot \sqrt{x}\right)\right)\right)}\right) \]
              5. distribute-neg-inN/A

                \[\leadsto \mathsf{/.f64}\left(6, \left(\left(\mathsf{neg}\left(1\right)\right) + \color{blue}{\left(\mathsf{neg}\left(4 \cdot \sqrt{x}\right)\right)}\right)\right) \]
              6. metadata-evalN/A

                \[\leadsto \mathsf{/.f64}\left(6, \left(-1 + \left(\mathsf{neg}\left(\color{blue}{4 \cdot \sqrt{x}}\right)\right)\right)\right) \]
              7. distribute-lft-neg-inN/A

                \[\leadsto \mathsf{/.f64}\left(6, \left(-1 + \left(\mathsf{neg}\left(4\right)\right) \cdot \color{blue}{\sqrt{x}}\right)\right) \]
              8. metadata-evalN/A

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

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

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

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{-4}\right)\right)\right) \]
              12. sqrt-lowering-sqrt.f6498.8%

                \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), -4\right)\right)\right) \]
            5. Simplified98.8%

              \[\leadsto \color{blue}{\frac{6}{-1 + \sqrt{x} \cdot -4}} \]

            if 1 < x

            1. Initial program 99.6%

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, 6\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{+.f64}\left(x, 1\right)}, \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right) \]
            5. Simplified96.3%

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

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

                \[\leadsto \frac{x \cdot 6}{\color{blue}{x} + 4 \cdot \sqrt{x}} \]
              2. Taylor expanded in x around 0

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \frac{3}{2}\right) \]
              4. Simplified7.4%

                \[\leadsto \color{blue}{\sqrt{x} \cdot 1.5} \]
            8. Recombined 2 regimes into one program.
            9. Add Preprocessing

            Alternative 10: 7.0% accurate, 1.0× speedup?

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

              1. Initial program 99.9%

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

                \[\leadsto \color{blue}{\frac{-6}{1 + 4 \cdot \sqrt{x}}} \]
              4. Step-by-step derivation
                1. metadata-evalN/A

                  \[\leadsto \frac{\mathsf{neg}\left(6\right)}{\color{blue}{1} + 4 \cdot \sqrt{x}} \]
                2. distribute-neg-fracN/A

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

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

                  \[\leadsto \mathsf{/.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(\left(1 + 4 \cdot \sqrt{x}\right)\right)\right)}\right) \]
                5. distribute-neg-inN/A

                  \[\leadsto \mathsf{/.f64}\left(6, \left(\left(\mathsf{neg}\left(1\right)\right) + \color{blue}{\left(\mathsf{neg}\left(4 \cdot \sqrt{x}\right)\right)}\right)\right) \]
                6. metadata-evalN/A

                  \[\leadsto \mathsf{/.f64}\left(6, \left(-1 + \left(\mathsf{neg}\left(\color{blue}{4 \cdot \sqrt{x}}\right)\right)\right)\right) \]
                7. distribute-lft-neg-inN/A

                  \[\leadsto \mathsf{/.f64}\left(6, \left(-1 + \left(\mathsf{neg}\left(4\right)\right) \cdot \color{blue}{\sqrt{x}}\right)\right) \]
                8. metadata-evalN/A

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

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

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

                  \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{-4}\right)\right)\right) \]
                12. sqrt-lowering-sqrt.f6498.8%

                  \[\leadsto \mathsf{/.f64}\left(6, \mathsf{+.f64}\left(-1, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), -4\right)\right)\right) \]
              5. Simplified98.8%

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{1}{x}\right)\right), \frac{-3}{2}\right) \]
                4. /-lowering-/.f647.0%

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right), \frac{-3}{2}\right) \]
              8. Simplified7.0%

                \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} \cdot -1.5} \]
              9. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \frac{-3}{2} \cdot \color{blue}{\sqrt{\frac{1}{x}}} \]
                2. sqrt-divN/A

                  \[\leadsto \frac{-3}{2} \cdot \frac{\sqrt{1}}{\color{blue}{\sqrt{x}}} \]
                3. metadata-evalN/A

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

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

                  \[\leadsto \mathsf{/.f64}\left(\frac{-3}{2}, \color{blue}{\left(\sqrt{x}\right)}\right) \]
                6. sqrt-lowering-sqrt.f647.0%

                  \[\leadsto \mathsf{/.f64}\left(\frac{-3}{2}, \mathsf{sqrt.f64}\left(x\right)\right) \]
              10. Applied egg-rr7.0%

                \[\leadsto \color{blue}{\frac{-1.5}{\sqrt{x}}} \]

              if 1 < x

              1. Initial program 99.6%

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

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

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

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, 6\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{+.f64}\left(x, 1\right)}, \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right) \]
              5. Simplified96.3%

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

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

                  \[\leadsto \frac{x \cdot 6}{\color{blue}{x} + 4 \cdot \sqrt{x}} \]
                2. Taylor expanded in x around 0

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \frac{3}{2}\right) \]
                4. Simplified7.4%

                  \[\leadsto \color{blue}{\sqrt{x} \cdot 1.5} \]
              8. Recombined 2 regimes into one program.
              9. Add Preprocessing

              Alternative 11: 4.5% accurate, 1.1× speedup?

              \[\begin{array}{l} \\ \sqrt{x} \cdot 1.5 \end{array} \]
              (FPCore (x) :precision binary64 (* (sqrt x) 1.5))
              double code(double x) {
              	return sqrt(x) * 1.5;
              }
              
              real(8) function code(x)
                  real(8), intent (in) :: x
                  code = sqrt(x) * 1.5d0
              end function
              
              public static double code(double x) {
              	return Math.sqrt(x) * 1.5;
              }
              
              def code(x):
              	return math.sqrt(x) * 1.5
              
              function code(x)
              	return Float64(sqrt(x) * 1.5)
              end
              
              function tmp = code(x)
              	tmp = sqrt(x) * 1.5;
              end
              
              code[x_] := N[(N[Sqrt[x], $MachinePrecision] * 1.5), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              \sqrt{x} \cdot 1.5
              \end{array}
              
              Derivation
              1. Initial program 99.8%

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

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

                  \[\leadsto \mathsf{/.f64}\left(\left(x \cdot 6\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{+.f64}\left(x, 1\right)}, \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right) \]
                2. *-lowering-*.f6451.5%

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, 6\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{+.f64}\left(x, 1\right)}, \mathsf{*.f64}\left(4, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right) \]
              5. Simplified51.5%

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

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

                  \[\leadsto \frac{x \cdot 6}{\color{blue}{x} + 4 \cdot \sqrt{x}} \]
                2. Taylor expanded in x around 0

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

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

                    \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{\frac{3}{2}}\right) \]
                  3. sqrt-lowering-sqrt.f644.8%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \frac{3}{2}\right) \]
                4. Simplified4.8%

                  \[\leadsto \color{blue}{\sqrt{x} \cdot 1.5} \]
                5. Add Preprocessing

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

                \[\begin{array}{l} \\ \frac{6}{\frac{\left(x + 1\right) + 4 \cdot \sqrt{x}}{x - 1}} \end{array} \]
                (FPCore (x)
                 :precision binary64
                 (/ 6.0 (/ (+ (+ x 1.0) (* 4.0 (sqrt x))) (- x 1.0))))
                double code(double x) {
                	return 6.0 / (((x + 1.0) + (4.0 * sqrt(x))) / (x - 1.0));
                }
                
                real(8) function code(x)
                    real(8), intent (in) :: x
                    code = 6.0d0 / (((x + 1.0d0) + (4.0d0 * sqrt(x))) / (x - 1.0d0))
                end function
                
                public static double code(double x) {
                	return 6.0 / (((x + 1.0) + (4.0 * Math.sqrt(x))) / (x - 1.0));
                }
                
                def code(x):
                	return 6.0 / (((x + 1.0) + (4.0 * math.sqrt(x))) / (x - 1.0))
                
                function code(x)
                	return Float64(6.0 / Float64(Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x))) / Float64(x - 1.0)))
                end
                
                function tmp = code(x)
                	tmp = 6.0 / (((x + 1.0) + (4.0 * sqrt(x))) / (x - 1.0));
                end
                
                code[x_] := N[(6.0 / N[(N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                
                \begin{array}{l}
                
                \\
                \frac{6}{\frac{\left(x + 1\right) + 4 \cdot \sqrt{x}}{x - 1}}
                \end{array}
                

                Reproduce

                ?
                herbie shell --seed 2024192 
                (FPCore (x)
                  :name "Data.Approximate.Numerics:blog from approximate-0.2.2.1"
                  :precision binary64
                
                  :alt
                  (! :herbie-platform default (/ 6 (/ (+ (+ x 1) (* 4 (sqrt x))) (- x 1))))
                
                  (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))