2isqrt (example 3.6)

Percentage Accurate: 38.9% → 99.6%
Time: 10.0s
Alternatives: 13
Speedup: 1.0×

Specification

?
\[x > 1 \land x < 10^{+308}\]
\[\begin{array}{l} \\ \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \end{array} \]
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
double code(double x) {
	return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (1.0d0 / sqrt(x)) - (1.0d0 / sqrt((x + 1.0d0)))
end function
public static double code(double x) {
	return (1.0 / Math.sqrt(x)) - (1.0 / Math.sqrt((x + 1.0)));
}
def code(x):
	return (1.0 / math.sqrt(x)) - (1.0 / math.sqrt((x + 1.0)))
function code(x)
	return Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(x + 1.0))))
end
function tmp = code(x)
	tmp = (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
end
code[x_] := N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 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: 38.9% accurate, 1.0× speedup?

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

\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}

Alternative 1: 99.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{x} + \sqrt{1 + x}} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ (/ 1.0 (hypot (sqrt x) x)) (+ (sqrt x) (sqrt (+ 1.0 x)))))
double code(double x) {
	return (1.0 / hypot(sqrt(x), x)) / (sqrt(x) + sqrt((1.0 + x)));
}
public static double code(double x) {
	return (1.0 / Math.hypot(Math.sqrt(x), x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
def code(x):
	return (1.0 / math.hypot(math.sqrt(x), x)) / (math.sqrt(x) + math.sqrt((1.0 + x)))
function code(x)
	return Float64(Float64(1.0 / hypot(sqrt(x), x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + x))))
end
function tmp = code(x)
	tmp = (1.0 / hypot(sqrt(x), x)) / (sqrt(x) + sqrt((1.0 + x)));
end
code[x_] := N[(N[(1.0 / N[Sqrt[N[Sqrt[x], $MachinePrecision] ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{x} + \sqrt{1 + x}}
\end{array}
Derivation
  1. Initial program 42.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. frac-sub42.4%

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-rgt-identity42.4%

      \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. *-un-lft-identity42.4%

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

      \[\leadsto \frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. sqrt-unprod42.4%

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  5. Step-by-step derivation
    1. flip--43.7%

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. add-sqr-sqrt43.6%

      \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. add-sqr-sqrt44.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. add-sqr-sqrt44.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\sqrt{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-1-def44.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{x}\right)} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  6. Applied egg-rr44.2%

    \[\leadsto \frac{\color{blue}{\frac{\left(1 + x\right) - x}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  7. Step-by-step derivation
    1. associate--l+84.9%

      \[\leadsto \frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. +-inverses84.9%

      \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. metadata-eval84.9%

      \[\leadsto \frac{\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. +-commutative84.9%

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-undefine84.9%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \color{blue}{\sqrt{1 \cdot 1 + \sqrt{x} \cdot \sqrt{x}}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    6. metadata-eval84.9%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{\color{blue}{1} + \sqrt{x} \cdot \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. rem-square-sqrt84.9%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + \color{blue}{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  8. Simplified84.9%

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

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

      \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1}{\sqrt{\color{blue}{1 \cdot x + x \cdot x}}} \]
    3. *-un-lft-identity84.9%

      \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1}{\sqrt{\color{blue}{x} + x \cdot x}} \]
    4. add-sqr-sqrt84.9%

      \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1}{\sqrt{\color{blue}{\sqrt{x} \cdot \sqrt{x}} + x \cdot x}} \]
    5. hypot-define99.6%

      \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(\sqrt{x}, x\right)}} \]
  10. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}} \]
  11. Step-by-step derivation
    1. frac-times98.8%

      \[\leadsto \color{blue}{\frac{1 \cdot 1}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \mathsf{hypot}\left(\sqrt{x}, x\right)}} \]
    2. metadata-eval98.8%

      \[\leadsto \frac{\color{blue}{1}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \mathsf{hypot}\left(\sqrt{x}, x\right)} \]
  12. Applied egg-rr98.8%

    \[\leadsto \color{blue}{\frac{1}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \mathsf{hypot}\left(\sqrt{x}, x\right)}} \]
  13. Step-by-step derivation
    1. associate-/l/99.7%

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{x} + \sqrt{1 + x}}} \]
  14. Simplified99.7%

    \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{x} + \sqrt{1 + x}}} \]
  15. Add Preprocessing

Alternative 2: 98.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right) \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ 1.0 (* (hypot (sqrt x) x) (+ (sqrt x) (sqrt (+ 1.0 x))))))
double code(double x) {
	return 1.0 / (hypot(sqrt(x), x) * (sqrt(x) + sqrt((1.0 + x))));
}
public static double code(double x) {
	return 1.0 / (Math.hypot(Math.sqrt(x), x) * (Math.sqrt(x) + Math.sqrt((1.0 + x))));
}
def code(x):
	return 1.0 / (math.hypot(math.sqrt(x), x) * (math.sqrt(x) + math.sqrt((1.0 + x))))
function code(x)
	return Float64(1.0 / Float64(hypot(sqrt(x), x) * Float64(sqrt(x) + sqrt(Float64(1.0 + x)))))
end
function tmp = code(x)
	tmp = 1.0 / (hypot(sqrt(x), x) * (sqrt(x) + sqrt((1.0 + x))));
end
code[x_] := N[(1.0 / N[(N[Sqrt[N[Sqrt[x], $MachinePrecision] ^ 2 + x ^ 2], $MachinePrecision] * N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right) \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}
\end{array}
Derivation
  1. Initial program 42.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. frac-sub42.4%

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-rgt-identity42.4%

      \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. *-un-lft-identity42.4%

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

      \[\leadsto \frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. sqrt-unprod42.4%

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  5. Step-by-step derivation
    1. flip--43.7%

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. add-sqr-sqrt43.6%

      \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. add-sqr-sqrt44.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. add-sqr-sqrt44.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\sqrt{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-1-def44.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{x}\right)} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  6. Applied egg-rr44.2%

    \[\leadsto \frac{\color{blue}{\frac{\left(1 + x\right) - x}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  7. Step-by-step derivation
    1. associate--l+84.9%

      \[\leadsto \frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. +-inverses84.9%

      \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. metadata-eval84.9%

      \[\leadsto \frac{\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. +-commutative84.9%

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-undefine84.9%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \color{blue}{\sqrt{1 \cdot 1 + \sqrt{x} \cdot \sqrt{x}}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    6. metadata-eval84.9%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{\color{blue}{1} + \sqrt{x} \cdot \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. rem-square-sqrt84.9%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + \color{blue}{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  8. Simplified84.9%

    \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  9. Step-by-step derivation
    1. *-un-lft-identity84.9%

      \[\leadsto \color{blue}{1 \cdot \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
    2. associate-/l/85.0%

      \[\leadsto 1 \cdot \color{blue}{\frac{1}{\sqrt{x \cdot \left(1 + x\right)} \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
    3. distribute-rgt-in85.0%

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

      \[\leadsto 1 \cdot \frac{1}{\sqrt{\color{blue}{x} + x \cdot x} \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)} \]
    5. add-sqr-sqrt85.0%

      \[\leadsto 1 \cdot \frac{1}{\sqrt{\color{blue}{\sqrt{x} \cdot \sqrt{x}} + x \cdot x} \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)} \]
    6. hypot-define98.8%

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

    \[\leadsto \color{blue}{1 \cdot \frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right) \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
  11. Step-by-step derivation
    1. *-lft-identity98.8%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right) \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
    2. *-commutative98.8%

      \[\leadsto \frac{1}{\color{blue}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \mathsf{hypot}\left(\sqrt{x}, x\right)}} \]
  12. Simplified98.8%

    \[\leadsto \color{blue}{\frac{1}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \mathsf{hypot}\left(\sqrt{x}, x\right)}} \]
  13. Final simplification98.8%

    \[\leadsto \frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right) \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)} \]
  14. Add Preprocessing

Alternative 3: 98.7% accurate, 1.0× speedup?

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

\\
\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{x \cdot \left(1 + \frac{0.5}{x}\right)}
\end{array}
Derivation
  1. Initial program 42.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. frac-sub42.4%

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-rgt-identity42.4%

      \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. *-un-lft-identity42.4%

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

      \[\leadsto \frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. sqrt-unprod42.4%

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  5. Step-by-step derivation
    1. flip--43.7%

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. add-sqr-sqrt43.6%

      \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. add-sqr-sqrt44.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. add-sqr-sqrt44.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\sqrt{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-1-def44.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{x}\right)} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  6. Applied egg-rr44.2%

    \[\leadsto \frac{\color{blue}{\frac{\left(1 + x\right) - x}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  7. Step-by-step derivation
    1. associate--l+84.9%

      \[\leadsto \frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. +-inverses84.9%

      \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. metadata-eval84.9%

      \[\leadsto \frac{\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. +-commutative84.9%

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-undefine84.9%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \color{blue}{\sqrt{1 \cdot 1 + \sqrt{x} \cdot \sqrt{x}}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    6. metadata-eval84.9%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{\color{blue}{1} + \sqrt{x} \cdot \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. rem-square-sqrt84.9%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + \color{blue}{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  8. Simplified84.9%

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

    \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\color{blue}{x \cdot \left(1 + 0.5 \cdot \frac{1}{x}\right)}} \]
  10. Step-by-step derivation
    1. associate-*r/98.4%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{x \cdot \left(1 + \color{blue}{\frac{0.5 \cdot 1}{x}}\right)} \]
    2. metadata-eval98.4%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{x \cdot \left(1 + \frac{\color{blue}{0.5}}{x}\right)} \]
  11. Simplified98.4%

    \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\color{blue}{x \cdot \left(1 + \frac{0.5}{x}\right)}} \]
  12. Add Preprocessing

Alternative 4: 98.6% accurate, 1.0× speedup?

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

\\
\frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1 - \frac{0.5}{x}}{x}
\end{array}
Derivation
  1. Initial program 42.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. frac-sub42.4%

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-rgt-identity42.4%

      \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. *-un-lft-identity42.4%

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

      \[\leadsto \frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. sqrt-unprod42.4%

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  5. Step-by-step derivation
    1. flip--43.7%

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. add-sqr-sqrt43.6%

      \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. add-sqr-sqrt44.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. add-sqr-sqrt44.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\sqrt{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-1-def44.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{x}\right)} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  6. Applied egg-rr44.2%

    \[\leadsto \frac{\color{blue}{\frac{\left(1 + x\right) - x}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  7. Step-by-step derivation
    1. associate--l+84.9%

      \[\leadsto \frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. +-inverses84.9%

      \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. metadata-eval84.9%

      \[\leadsto \frac{\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. +-commutative84.9%

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-undefine84.9%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \color{blue}{\sqrt{1 \cdot 1 + \sqrt{x} \cdot \sqrt{x}}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    6. metadata-eval84.9%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{\color{blue}{1} + \sqrt{x} \cdot \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. rem-square-sqrt84.9%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + \color{blue}{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  8. Simplified84.9%

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

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

      \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1}{\sqrt{\color{blue}{1 \cdot x + x \cdot x}}} \]
    3. *-un-lft-identity84.9%

      \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1}{\sqrt{\color{blue}{x} + x \cdot x}} \]
    4. add-sqr-sqrt84.9%

      \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1}{\sqrt{\color{blue}{\sqrt{x} \cdot \sqrt{x}} + x \cdot x}} \]
    5. hypot-define99.6%

      \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(\sqrt{x}, x\right)}} \]
  10. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}} \]
  11. Taylor expanded in x around inf 98.3%

    \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \color{blue}{\frac{1 - 0.5 \cdot \frac{1}{x}}{x}} \]
  12. Step-by-step derivation
    1. associate-*r/98.3%

      \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1 - \color{blue}{\frac{0.5 \cdot 1}{x}}}{x} \]
    2. metadata-eval98.3%

      \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \frac{1 - \frac{\color{blue}{0.5}}{x}}{x} \]
  13. Simplified98.3%

    \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \cdot \color{blue}{\frac{1 - \frac{0.5}{x}}{x}} \]
  14. Add Preprocessing

Alternative 5: 81.6% accurate, 1.0× speedup?

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

\\
\frac{0.5 \cdot {x}^{-0.5}}{\sqrt{x \cdot \left(1 + x\right)}}
\end{array}
Derivation
  1. Initial program 42.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. frac-sub42.4%

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-rgt-identity42.4%

      \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. *-un-lft-identity42.4%

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

      \[\leadsto \frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. sqrt-unprod42.4%

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

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

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

    \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  6. Step-by-step derivation
    1. *-commutative82.9%

      \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{x}} \cdot 0.5}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. unpow1/282.9%

      \[\leadsto \frac{\color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. rem-exp-log80.3%

      \[\leadsto \frac{{\left(\frac{1}{\color{blue}{e^{\log x}}}\right)}^{0.5} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. exp-neg80.3%

      \[\leadsto \frac{{\color{blue}{\left(e^{-\log x}\right)}}^{0.5} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. exp-prod80.3%

      \[\leadsto \frac{\color{blue}{e^{\left(-\log x\right) \cdot 0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    6. distribute-lft-neg-out80.3%

      \[\leadsto \frac{e^{\color{blue}{-\log x \cdot 0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. distribute-rgt-neg-in80.3%

      \[\leadsto \frac{e^{\color{blue}{\log x \cdot \left(-0.5\right)}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    8. metadata-eval80.3%

      \[\leadsto \frac{e^{\log x \cdot \color{blue}{-0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    9. exp-to-pow82.9%

      \[\leadsto \frac{\color{blue}{{x}^{-0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
  7. Simplified82.9%

    \[\leadsto \frac{\color{blue}{{x}^{-0.5} \cdot 0.5}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  8. Final simplification82.9%

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

Alternative 6: 66.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 0.5 \cdot \sqrt{\frac{1}{{x}^{3}}} \end{array} \]
(FPCore (x) :precision binary64 (* 0.5 (sqrt (/ 1.0 (pow x 3.0)))))
double code(double x) {
	return 0.5 * sqrt((1.0 / pow(x, 3.0)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 0.5d0 * sqrt((1.0d0 / (x ** 3.0d0)))
end function
public static double code(double x) {
	return 0.5 * Math.sqrt((1.0 / Math.pow(x, 3.0)));
}
def code(x):
	return 0.5 * math.sqrt((1.0 / math.pow(x, 3.0)))
function code(x)
	return Float64(0.5 * sqrt(Float64(1.0 / (x ^ 3.0))))
end
function tmp = code(x)
	tmp = 0.5 * sqrt((1.0 / (x ^ 3.0)));
end
code[x_] := N[(0.5 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}
\end{array}
Derivation
  1. Initial program 42.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf 69.6%

    \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
  4. Add Preprocessing

Alternative 7: 38.0% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \frac{\frac{1}{x} + \frac{-1 + \frac{1 + \frac{\frac{1}{x} + -1}{x}}{x}}{x}}{{x}^{-0.5} \cdot 2} \end{array} \]
(FPCore (x)
 :precision binary64
 (/
  (+ (/ 1.0 x) (/ (+ -1.0 (/ (+ 1.0 (/ (+ (/ 1.0 x) -1.0) x)) x)) x))
  (* (pow x -0.5) 2.0)))
double code(double x) {
	return ((1.0 / x) + ((-1.0 + ((1.0 + (((1.0 / x) + -1.0) / x)) / x)) / x)) / (pow(x, -0.5) * 2.0);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((1.0d0 / x) + (((-1.0d0) + ((1.0d0 + (((1.0d0 / x) + (-1.0d0)) / x)) / x)) / x)) / ((x ** (-0.5d0)) * 2.0d0)
end function
public static double code(double x) {
	return ((1.0 / x) + ((-1.0 + ((1.0 + (((1.0 / x) + -1.0) / x)) / x)) / x)) / (Math.pow(x, -0.5) * 2.0);
}
def code(x):
	return ((1.0 / x) + ((-1.0 + ((1.0 + (((1.0 / x) + -1.0) / x)) / x)) / x)) / (math.pow(x, -0.5) * 2.0)
function code(x)
	return Float64(Float64(Float64(1.0 / x) + Float64(Float64(-1.0 + Float64(Float64(1.0 + Float64(Float64(Float64(1.0 / x) + -1.0) / x)) / x)) / x)) / Float64((x ^ -0.5) * 2.0))
end
function tmp = code(x)
	tmp = ((1.0 / x) + ((-1.0 + ((1.0 + (((1.0 / x) + -1.0) / x)) / x)) / x)) / ((x ^ -0.5) * 2.0);
end
code[x_] := N[(N[(N[(1.0 / x), $MachinePrecision] + N[(N[(-1.0 + N[(N[(1.0 + N[(N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{1}{x} + \frac{-1 + \frac{1 + \frac{\frac{1}{x} + -1}{x}}{x}}{x}}{{x}^{-0.5} \cdot 2}
\end{array}
Derivation
  1. Initial program 42.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--42.3%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}} \]
    2. div-inv42.3%

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

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

      \[\leadsto \left(\frac{\color{blue}{1}}{\sqrt{x} \cdot \sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    5. add-sqr-sqrt20.6%

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

      \[\leadsto \left(\frac{1}{x} - \color{blue}{\frac{1 \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    7. metadata-eval28.9%

      \[\leadsto \left(\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    8. add-sqr-sqrt42.5%

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

      \[\leadsto \left(\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    10. inv-pow42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{\color{blue}{{\left(\sqrt{x}\right)}^{-1}} + \frac{1}{\sqrt{x + 1}}} \]
    11. sqrt-pow242.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} + \frac{1}{\sqrt{x + 1}}} \]
    12. metadata-eval42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}} \]
    13. pow1/242.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}} \]
    14. pow-flip42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + \color{blue}{{\left(x + 1\right)}^{\left(-0.5\right)}}} \]
    15. +-commutative42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + {\color{blue}{\left(1 + x\right)}}^{\left(-0.5\right)}} \]
    16. metadata-eval42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{\color{blue}{-0.5}}} \]
  4. Applied egg-rr42.5%

    \[\leadsto \color{blue}{\left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  5. Step-by-step derivation
    1. associate-*r/42.5%

      \[\leadsto \color{blue}{\frac{\left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot 1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
    2. *-rgt-identity42.5%

      \[\leadsto \frac{\color{blue}{\frac{1}{x} - \frac{1}{1 + x}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
  6. Simplified42.5%

    \[\leadsto \color{blue}{\frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  7. Taylor expanded in x around -inf 42.0%

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

    \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{\color{blue}{2 \cdot \sqrt{\frac{1}{x}}}} \]
  9. Step-by-step derivation
    1. *-commutative41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{\color{blue}{\sqrt{\frac{1}{x}} \cdot 2}} \]
    2. unpow1/241.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{\color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \cdot 2} \]
    3. rem-exp-log41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{{\left(\frac{1}{\color{blue}{e^{\log x}}}\right)}^{0.5} \cdot 2} \]
    4. exp-neg41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{{\color{blue}{\left(e^{-\log x}\right)}}^{0.5} \cdot 2} \]
    5. exp-prod41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{\color{blue}{e^{\left(-\log x\right) \cdot 0.5}} \cdot 2} \]
    6. distribute-lft-neg-out41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{e^{\color{blue}{-\log x \cdot 0.5}} \cdot 2} \]
    7. distribute-rgt-neg-in41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{e^{\color{blue}{\log x \cdot \left(-0.5\right)}} \cdot 2} \]
    8. metadata-eval41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{e^{\log x \cdot \color{blue}{-0.5}} \cdot 2} \]
    9. exp-to-pow41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{\color{blue}{{x}^{-0.5}} \cdot 2} \]
  10. Simplified41.1%

    \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{\color{blue}{{x}^{-0.5} \cdot 2}} \]
  11. Final simplification41.1%

    \[\leadsto \frac{\frac{1}{x} + \frac{-1 + \frac{1 + \frac{\frac{1}{x} + -1}{x}}{x}}{x}}{{x}^{-0.5} \cdot 2} \]
  12. Add Preprocessing

Alternative 8: 38.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \frac{\frac{1}{x} + \frac{1}{-1 - x}}{{x}^{-0.5} \cdot 2} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ (+ (/ 1.0 x) (/ 1.0 (- -1.0 x))) (* (pow x -0.5) 2.0)))
double code(double x) {
	return ((1.0 / x) + (1.0 / (-1.0 - x))) / (pow(x, -0.5) * 2.0);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((1.0d0 / x) + (1.0d0 / ((-1.0d0) - x))) / ((x ** (-0.5d0)) * 2.0d0)
end function
public static double code(double x) {
	return ((1.0 / x) + (1.0 / (-1.0 - x))) / (Math.pow(x, -0.5) * 2.0);
}
def code(x):
	return ((1.0 / x) + (1.0 / (-1.0 - x))) / (math.pow(x, -0.5) * 2.0)
function code(x)
	return Float64(Float64(Float64(1.0 / x) + Float64(1.0 / Float64(-1.0 - x))) / Float64((x ^ -0.5) * 2.0))
end
function tmp = code(x)
	tmp = ((1.0 / x) + (1.0 / (-1.0 - x))) / ((x ^ -0.5) * 2.0);
end
code[x_] := N[(N[(N[(1.0 / x), $MachinePrecision] + N[(1.0 / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{1}{x} + \frac{1}{-1 - x}}{{x}^{-0.5} \cdot 2}
\end{array}
Derivation
  1. Initial program 42.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--42.3%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}} \]
    2. div-inv42.3%

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

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

      \[\leadsto \left(\frac{\color{blue}{1}}{\sqrt{x} \cdot \sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    5. add-sqr-sqrt20.6%

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

      \[\leadsto \left(\frac{1}{x} - \color{blue}{\frac{1 \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    7. metadata-eval28.9%

      \[\leadsto \left(\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    8. add-sqr-sqrt42.5%

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

      \[\leadsto \left(\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    10. inv-pow42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{\color{blue}{{\left(\sqrt{x}\right)}^{-1}} + \frac{1}{\sqrt{x + 1}}} \]
    11. sqrt-pow242.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} + \frac{1}{\sqrt{x + 1}}} \]
    12. metadata-eval42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}} \]
    13. pow1/242.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}} \]
    14. pow-flip42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + \color{blue}{{\left(x + 1\right)}^{\left(-0.5\right)}}} \]
    15. +-commutative42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + {\color{blue}{\left(1 + x\right)}}^{\left(-0.5\right)}} \]
    16. metadata-eval42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{\color{blue}{-0.5}}} \]
  4. Applied egg-rr42.5%

    \[\leadsto \color{blue}{\left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  5. Step-by-step derivation
    1. associate-*r/42.5%

      \[\leadsto \color{blue}{\frac{\left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot 1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
    2. *-rgt-identity42.5%

      \[\leadsto \frac{\color{blue}{\frac{1}{x} - \frac{1}{1 + x}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
  6. Simplified42.5%

    \[\leadsto \color{blue}{\frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  7. Taylor expanded in x around inf 41.1%

    \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{2 \cdot \sqrt{\frac{1}{x}}}} \]
  8. Step-by-step derivation
    1. *-commutative41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{\color{blue}{\sqrt{\frac{1}{x}} \cdot 2}} \]
    2. unpow1/241.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{\color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \cdot 2} \]
    3. rem-exp-log41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{{\left(\frac{1}{\color{blue}{e^{\log x}}}\right)}^{0.5} \cdot 2} \]
    4. exp-neg41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{{\color{blue}{\left(e^{-\log x}\right)}}^{0.5} \cdot 2} \]
    5. exp-prod41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{\color{blue}{e^{\left(-\log x\right) \cdot 0.5}} \cdot 2} \]
    6. distribute-lft-neg-out41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{e^{\color{blue}{-\log x \cdot 0.5}} \cdot 2} \]
    7. distribute-rgt-neg-in41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{e^{\color{blue}{\log x \cdot \left(-0.5\right)}} \cdot 2} \]
    8. metadata-eval41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{e^{\log x \cdot \color{blue}{-0.5}} \cdot 2} \]
    9. exp-to-pow41.1%

      \[\leadsto \frac{\frac{1}{x} - -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{x} - 1}{x} - 1}{x} - 1}{x}}{\color{blue}{{x}^{-0.5}} \cdot 2} \]
  9. Simplified41.1%

    \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{{x}^{-0.5} \cdot 2}} \]
  10. Final simplification41.1%

    \[\leadsto \frac{\frac{1}{x} + \frac{1}{-1 - x}}{{x}^{-0.5} \cdot 2} \]
  11. Add Preprocessing

Alternative 9: 38.0% accurate, 1.8× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--42.3%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}} \]
    2. div-inv42.3%

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

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

      \[\leadsto \left(\frac{\color{blue}{1}}{\sqrt{x} \cdot \sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    5. add-sqr-sqrt20.6%

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

      \[\leadsto \left(\frac{1}{x} - \color{blue}{\frac{1 \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    7. metadata-eval28.9%

      \[\leadsto \left(\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    8. add-sqr-sqrt42.5%

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

      \[\leadsto \left(\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    10. inv-pow42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{\color{blue}{{\left(\sqrt{x}\right)}^{-1}} + \frac{1}{\sqrt{x + 1}}} \]
    11. sqrt-pow242.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} + \frac{1}{\sqrt{x + 1}}} \]
    12. metadata-eval42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}} \]
    13. pow1/242.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}} \]
    14. pow-flip42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + \color{blue}{{\left(x + 1\right)}^{\left(-0.5\right)}}} \]
    15. +-commutative42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + {\color{blue}{\left(1 + x\right)}}^{\left(-0.5\right)}} \]
    16. metadata-eval42.5%

      \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{\color{blue}{-0.5}}} \]
  4. Applied egg-rr42.5%

    \[\leadsto \color{blue}{\left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  5. Taylor expanded in x around inf 41.1%

    \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \color{blue}{\left(0.5 \cdot \sqrt{x}\right)} \]
  6. Step-by-step derivation
    1. *-commutative41.1%

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

    \[\leadsto \left(\frac{1}{x} - \frac{1}{1 + x}\right) \cdot \color{blue}{\left(\sqrt{x} \cdot 0.5\right)} \]
  8. Final simplification41.1%

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

Alternative 10: 38.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.6 \cdot 10^{+153}:\\
\;\;\;\;\frac{1 - \sqrt{\frac{1}{x}}}{x}\\

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 10.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-sub11.0%

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. *-rgt-identity11.0%

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      3. *-un-lft-identity11.0%

        \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      4. +-commutative11.0%

        \[\leadsto \frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      5. sqrt-unprod11.0%

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

        \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \color{blue}{\left(1 + x\right)}}} \]
    4. Applied egg-rr11.0%

      \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
    5. Step-by-step derivation
      1. flip--13.6%

        \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      2. add-sqr-sqrt13.5%

        \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      3. add-sqr-sqrt14.6%

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

        \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\sqrt{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      5. hypot-1-def14.6%

        \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{x}\right)} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    6. Applied egg-rr14.6%

      \[\leadsto \frac{\color{blue}{\frac{\left(1 + x\right) - x}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. Step-by-step derivation
      1. associate--l+99.3%

        \[\leadsto \frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      2. +-inverses99.3%

        \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      3. metadata-eval99.3%

        \[\leadsto \frac{\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      4. +-commutative99.3%

        \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      5. hypot-undefine99.4%

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

        \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{\color{blue}{1} + \sqrt{x} \cdot \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      7. rem-square-sqrt99.4%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} \cdot \frac{1}{1 + \sqrt{x}}} \]
    10. Step-by-step derivation
      1. *-commutative8.4%

        \[\leadsto \color{blue}{\frac{1}{1 + \sqrt{x}} \cdot \sqrt{\frac{1}{x}}} \]
    11. Simplified8.4%

      \[\leadsto \color{blue}{\frac{1}{1 + \sqrt{x}} \cdot \sqrt{\frac{1}{x}}} \]
    12. Taylor expanded in x around inf 8.4%

      \[\leadsto \color{blue}{\frac{1 + -1 \cdot \sqrt{\frac{1}{x}}}{x}} \]
    13. Step-by-step derivation
      1. mul-1-neg8.4%

        \[\leadsto \frac{1 + \color{blue}{\left(-\sqrt{\frac{1}{x}}\right)}}{x} \]
      2. unsub-neg8.4%

        \[\leadsto \frac{\color{blue}{1 - \sqrt{\frac{1}{x}}}}{x} \]
    14. Simplified8.4%

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

    if 4.6000000000000003e153 < x

    1. Initial program 71.1%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt11.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}} - \frac{1}{\sqrt{x + 1}} \]
      2. associate-*l*11.6%

        \[\leadsto \color{blue}{\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right)} - \frac{1}{\sqrt{x + 1}} \]
      3. inv-pow11.6%

        \[\leadsto \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) - \color{blue}{{\left(\sqrt{x + 1}\right)}^{-1}} \]
      4. add-cube-cbrt17.4%

        \[\leadsto \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) - {\color{blue}{\left(\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right) \cdot \sqrt[3]{\sqrt{x + 1}}\right)}}^{-1} \]
      5. unpow-prod-down22.7%

        \[\leadsto \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) - \color{blue}{{\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1}} \]
      6. prod-diff21.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{\frac{1}{\sqrt{x}}}, \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}, -{\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1}\right) + \mathsf{fma}\left(-{\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1}\right)} \]
    4. Applied egg-rr16.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, -{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + \mathsf{fma}\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1}, {\left(\sqrt[3]{1 + x}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)} \]
    5. Step-by-step derivation
      1. fma-undefine4.4%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, -{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + \color{blue}{\left(\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1}\right) \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1} + {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)} \]
      2. distribute-lft-neg-in4.4%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, -{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + \left(\color{blue}{\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)} + {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) \]
      3. fma-undefine23.4%

        \[\leadsto \color{blue}{\left(\sqrt[3]{{x}^{-0.5}} \cdot \sqrt[3]{\frac{1}{x}} + \left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)\right)} + \left(\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) \]
      4. +-commutative23.4%

        \[\leadsto \left(\sqrt[3]{{x}^{-0.5}} \cdot \sqrt[3]{\frac{1}{x}} + \left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)\right) + \color{blue}{\left({\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1} + \left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)\right)} \]
    6. Simplified4.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, \frac{\frac{-1}{\sqrt[3]{1 + x}}}{\sqrt[3]{\sqrt{1 + x}}}\right)} \]
    7. Taylor expanded in x around inf 71.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} + -1 \cdot \sqrt{\frac{1}{x}}} \]
    8. Step-by-step derivation
      1. distribute-rgt1-in71.1%

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

        \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
      3. mul0-lft71.1%

        \[\leadsto \color{blue}{0} \]
    9. Simplified71.1%

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

Alternative 11: 38.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.6 \cdot 10^{+153}:\\
\;\;\;\;\frac{1}{x + \sqrt{x}}\\

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 10.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-sub11.0%

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. *-rgt-identity11.0%

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      3. *-un-lft-identity11.0%

        \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      4. +-commutative11.0%

        \[\leadsto \frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      5. sqrt-unprod11.0%

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

        \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \color{blue}{\left(1 + x\right)}}} \]
    4. Applied egg-rr11.0%

      \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
    5. Step-by-step derivation
      1. flip--13.6%

        \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      2. add-sqr-sqrt13.5%

        \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      3. add-sqr-sqrt14.6%

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

        \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\sqrt{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      5. hypot-1-def14.6%

        \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{x}\right)} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    6. Applied egg-rr14.6%

      \[\leadsto \frac{\color{blue}{\frac{\left(1 + x\right) - x}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. Step-by-step derivation
      1. associate--l+99.3%

        \[\leadsto \frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      2. +-inverses99.3%

        \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      3. metadata-eval99.3%

        \[\leadsto \frac{\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      4. +-commutative99.3%

        \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      5. hypot-undefine99.4%

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

        \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{\color{blue}{1} + \sqrt{x} \cdot \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      7. rem-square-sqrt99.4%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} \cdot \frac{1}{1 + \sqrt{x}}} \]
    10. Step-by-step derivation
      1. *-commutative8.4%

        \[\leadsto \color{blue}{\frac{1}{1 + \sqrt{x}} \cdot \sqrt{\frac{1}{x}}} \]
    11. Simplified8.4%

      \[\leadsto \color{blue}{\frac{1}{1 + \sqrt{x}} \cdot \sqrt{\frac{1}{x}}} \]
    12. Step-by-step derivation
      1. sqrt-div8.4%

        \[\leadsto \frac{1}{1 + \sqrt{x}} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{x}}} \]
      2. metadata-eval8.4%

        \[\leadsto \frac{1}{1 + \sqrt{x}} \cdot \frac{\color{blue}{1}}{\sqrt{x}} \]
      3. frac-times8.4%

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

        \[\leadsto \frac{\color{blue}{1}}{\left(1 + \sqrt{x}\right) \cdot \sqrt{x}} \]
    13. Applied egg-rr8.4%

      \[\leadsto \color{blue}{\frac{1}{\left(1 + \sqrt{x}\right) \cdot \sqrt{x}}} \]
    14. Step-by-step derivation
      1. *-commutative8.4%

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

        \[\leadsto \frac{1}{\sqrt{x} \cdot \color{blue}{\left(\sqrt{x} + 1\right)}} \]
      3. distribute-lft-in8.4%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{x} \cdot \sqrt{x} + \sqrt{x} \cdot 1}} \]
      4. rem-square-sqrt8.4%

        \[\leadsto \frac{1}{\color{blue}{x} + \sqrt{x} \cdot 1} \]
      5. *-rgt-identity8.4%

        \[\leadsto \frac{1}{x + \color{blue}{\sqrt{x}}} \]
    15. Simplified8.4%

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

    if 4.6000000000000003e153 < x

    1. Initial program 71.1%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt11.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}} - \frac{1}{\sqrt{x + 1}} \]
      2. associate-*l*11.6%

        \[\leadsto \color{blue}{\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right)} - \frac{1}{\sqrt{x + 1}} \]
      3. inv-pow11.6%

        \[\leadsto \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) - \color{blue}{{\left(\sqrt{x + 1}\right)}^{-1}} \]
      4. add-cube-cbrt17.4%

        \[\leadsto \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) - {\color{blue}{\left(\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right) \cdot \sqrt[3]{\sqrt{x + 1}}\right)}}^{-1} \]
      5. unpow-prod-down22.7%

        \[\leadsto \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) - \color{blue}{{\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1}} \]
      6. prod-diff21.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{\frac{1}{\sqrt{x}}}, \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}, -{\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1}\right) + \mathsf{fma}\left(-{\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1}\right)} \]
    4. Applied egg-rr16.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, -{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + \mathsf{fma}\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1}, {\left(\sqrt[3]{1 + x}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)} \]
    5. Step-by-step derivation
      1. fma-undefine4.4%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, -{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + \color{blue}{\left(\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1}\right) \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1} + {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)} \]
      2. distribute-lft-neg-in4.4%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, -{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + \left(\color{blue}{\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)} + {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) \]
      3. fma-undefine23.4%

        \[\leadsto \color{blue}{\left(\sqrt[3]{{x}^{-0.5}} \cdot \sqrt[3]{\frac{1}{x}} + \left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)\right)} + \left(\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) \]
      4. +-commutative23.4%

        \[\leadsto \left(\sqrt[3]{{x}^{-0.5}} \cdot \sqrt[3]{\frac{1}{x}} + \left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)\right) + \color{blue}{\left({\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1} + \left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)\right)} \]
    6. Simplified4.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, \frac{\frac{-1}{\sqrt[3]{1 + x}}}{\sqrt[3]{\sqrt{1 + x}}}\right)} \]
    7. Taylor expanded in x around inf 71.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} + -1 \cdot \sqrt{\frac{1}{x}}} \]
    8. Step-by-step derivation
      1. distribute-rgt1-in71.1%

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

        \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
      3. mul0-lft71.1%

        \[\leadsto \color{blue}{0} \]
    9. Simplified71.1%

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

Alternative 12: 38.1% accurate, 26.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.6 \cdot 10^{+153}:\\
\;\;\;\;\frac{1}{x}\\

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 10.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-sub11.0%

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. *-rgt-identity11.0%

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      3. *-un-lft-identity11.0%

        \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      4. +-commutative11.0%

        \[\leadsto \frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      5. sqrt-unprod11.0%

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

        \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \color{blue}{\left(1 + x\right)}}} \]
    4. Applied egg-rr11.0%

      \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
    5. Step-by-step derivation
      1. flip--13.6%

        \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      2. add-sqr-sqrt13.5%

        \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      3. add-sqr-sqrt14.6%

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

        \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\sqrt{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      5. hypot-1-def14.6%

        \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{x}\right)} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    6. Applied egg-rr14.6%

      \[\leadsto \frac{\color{blue}{\frac{\left(1 + x\right) - x}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. Step-by-step derivation
      1. associate--l+99.3%

        \[\leadsto \frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      2. +-inverses99.3%

        \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      3. metadata-eval99.3%

        \[\leadsto \frac{\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      4. +-commutative99.3%

        \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      5. hypot-undefine99.4%

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

        \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{\color{blue}{1} + \sqrt{x} \cdot \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      7. rem-square-sqrt99.4%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} \cdot \frac{1}{1 + \sqrt{x}}} \]
    10. Step-by-step derivation
      1. *-commutative8.4%

        \[\leadsto \color{blue}{\frac{1}{1 + \sqrt{x}} \cdot \sqrt{\frac{1}{x}}} \]
    11. Simplified8.4%

      \[\leadsto \color{blue}{\frac{1}{1 + \sqrt{x}} \cdot \sqrt{\frac{1}{x}}} \]
    12. Taylor expanded in x around inf 8.4%

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

    if 4.6000000000000003e153 < x

    1. Initial program 71.1%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt11.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}} - \frac{1}{\sqrt{x + 1}} \]
      2. associate-*l*11.6%

        \[\leadsto \color{blue}{\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right)} - \frac{1}{\sqrt{x + 1}} \]
      3. inv-pow11.6%

        \[\leadsto \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) - \color{blue}{{\left(\sqrt{x + 1}\right)}^{-1}} \]
      4. add-cube-cbrt17.4%

        \[\leadsto \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) - {\color{blue}{\left(\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right) \cdot \sqrt[3]{\sqrt{x + 1}}\right)}}^{-1} \]
      5. unpow-prod-down22.7%

        \[\leadsto \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) - \color{blue}{{\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1}} \]
      6. prod-diff21.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{\frac{1}{\sqrt{x}}}, \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}, -{\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1}\right) + \mathsf{fma}\left(-{\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1}\right)} \]
    4. Applied egg-rr16.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, -{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + \mathsf{fma}\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1}, {\left(\sqrt[3]{1 + x}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)} \]
    5. Step-by-step derivation
      1. fma-undefine4.4%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, -{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + \color{blue}{\left(\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1}\right) \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1} + {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)} \]
      2. distribute-lft-neg-in4.4%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, -{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + \left(\color{blue}{\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)} + {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) \]
      3. fma-undefine23.4%

        \[\leadsto \color{blue}{\left(\sqrt[3]{{x}^{-0.5}} \cdot \sqrt[3]{\frac{1}{x}} + \left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)\right)} + \left(\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) \]
      4. +-commutative23.4%

        \[\leadsto \left(\sqrt[3]{{x}^{-0.5}} \cdot \sqrt[3]{\frac{1}{x}} + \left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)\right) + \color{blue}{\left({\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1} + \left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)\right)} \]
    6. Simplified4.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, \frac{\frac{-1}{\sqrt[3]{1 + x}}}{\sqrt[3]{\sqrt{1 + x}}}\right)} \]
    7. Taylor expanded in x around inf 71.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} + -1 \cdot \sqrt{\frac{1}{x}}} \]
    8. Step-by-step derivation
      1. distribute-rgt1-in71.1%

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

        \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
      3. mul0-lft71.1%

        \[\leadsto \color{blue}{0} \]
    9. Simplified71.1%

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

Alternative 13: 36.1% accurate, 209.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (x) :precision binary64 0.0)
double code(double x) {
	return 0.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 0.0d0
end function
public static double code(double x) {
	return 0.0;
}
def code(x):
	return 0.0
function code(x)
	return 0.0
end
function tmp = code(x)
	tmp = 0.0;
end
code[x_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 42.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cube-cbrt10.8%

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}} - \frac{1}{\sqrt{x + 1}} \]
    2. associate-*l*10.8%

      \[\leadsto \color{blue}{\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right)} - \frac{1}{\sqrt{x + 1}} \]
    3. inv-pow10.8%

      \[\leadsto \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) - \color{blue}{{\left(\sqrt{x + 1}\right)}^{-1}} \]
    4. add-cube-cbrt14.1%

      \[\leadsto \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) - {\color{blue}{\left(\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right) \cdot \sqrt[3]{\sqrt{x + 1}}\right)}}^{-1} \]
    5. unpow-prod-down16.9%

      \[\leadsto \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}\right) - \color{blue}{{\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1}} \]
    6. prod-diff16.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{\frac{1}{\sqrt{x}}}, \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}, -{\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1}\right) + \mathsf{fma}\left(-{\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x + 1}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x + 1}} \cdot \sqrt[3]{\sqrt{x + 1}}\right)}^{-1}\right)} \]
  4. Applied egg-rr13.3%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, -{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + \mathsf{fma}\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1}, {\left(\sqrt[3]{1 + x}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)} \]
  5. Step-by-step derivation
    1. fma-undefine7.2%

      \[\leadsto \mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, -{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + \color{blue}{\left(\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1}\right) \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1} + {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)} \]
    2. distribute-lft-neg-in7.2%

      \[\leadsto \mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, -{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + \left(\color{blue}{\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)} + {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) \]
    3. fma-undefine17.1%

      \[\leadsto \color{blue}{\left(\sqrt[3]{{x}^{-0.5}} \cdot \sqrt[3]{\frac{1}{x}} + \left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)\right)} + \left(\left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) + {\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right) \]
    4. +-commutative17.1%

      \[\leadsto \left(\sqrt[3]{{x}^{-0.5}} \cdot \sqrt[3]{\frac{1}{x}} + \left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)\right) + \color{blue}{\left({\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1} + \left(-{\left(\sqrt[3]{\sqrt{1 + x}}\right)}^{-1} \cdot {\left(\sqrt[3]{1 + x}\right)}^{-1}\right)\right)} \]
  6. Simplified7.3%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, \frac{\frac{-1}{\sqrt[3]{1 + x}}}{\sqrt[3]{\sqrt{1 + x}}}\right)} \]
  7. Taylor expanded in x around inf 39.3%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} + -1 \cdot \sqrt{\frac{1}{x}}} \]
  8. Step-by-step derivation
    1. distribute-rgt1-in39.3%

      \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot \sqrt{\frac{1}{x}}} \]
    2. metadata-eval39.3%

      \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
    3. mul0-lft39.3%

      \[\leadsto \color{blue}{0} \]
  9. Simplified39.3%

    \[\leadsto \color{blue}{0} \]
  10. Add Preprocessing

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

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

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

Reproduce

?
herbie shell --seed 2024145 
(FPCore (x)
  :name "2isqrt (example 3.6)"
  :precision binary64
  :pre (and (> x 1.0) (< x 1e+308))

  :alt
  (! :herbie-platform default (/ 1 (+ (* (+ x 1) (sqrt x)) (* x (sqrt (+ x 1))))))

  (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))