2isqrt (example 3.6)

Percentage Accurate: 38.6% → 99.6%
Time: 4.1s
Alternatives: 9
Speedup: 1.5×

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)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x)
use fmin_fmax_functions
    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}

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 9 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.6% 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)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x)
use fmin_fmax_functions
    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.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 10^{+52}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{\mathsf{fma}\left(x, x, x\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.5 \cdot \sqrt{x}}{x}}{x}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 1e+52)
   (/ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (sqrt (fma x x x)))
   (/ (/ (* 0.5 (sqrt x)) x) x)))
double code(double x) {
	double tmp;
	if (x <= 1e+52) {
		tmp = (1.0 / (sqrt((x + 1.0)) + sqrt(x))) / sqrt(fma(x, x, x));
	} else {
		tmp = ((0.5 * sqrt(x)) / x) / x;
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (x <= 1e+52)
		tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) / sqrt(fma(x, x, x)));
	else
		tmp = Float64(Float64(Float64(0.5 * sqrt(x)) / x) / x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, 1e+52], N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(x * x + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+52}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{\mathsf{fma}\left(x, x, x\right)}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5 \cdot \sqrt{x}}{x}}{x}\\


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

    1. Initial program 21.0%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}} \]
      2. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
      3. lift-sqrt.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
      4. lift-/.f64N/A

        \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}}} \]
      5. lift-+.f64N/A

        \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{\color{blue}{x + 1}}} \]
      6. lift-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\sqrt{x + 1}}} \]
      7. frac-subN/A

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      9. lower--.f64N/A

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      10. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      11. lift-sqrt.f64N/A

        \[\leadsto \frac{1 \cdot \color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      12. lift-+.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      14. lift-sqrt.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      15. lower-*.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      16. lift-sqrt.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x}} \cdot \sqrt{x + 1}} \]
      17. lift-sqrt.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \color{blue}{\sqrt{x + 1}}} \]
      18. lift-+.f6421.3

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

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

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

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      3. lift-+.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      4. lift-sqrt.f64N/A

        \[\leadsto \frac{1 \cdot \color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      6. lift-sqrt.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      7. flip--N/A

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    7. Step-by-step derivation
      1. Applied rewrites99.0%

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

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\color{blue}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
        2. lift-sqrt.f64N/A

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\color{blue}{\sqrt{x}} \cdot \sqrt{x + 1}} \]
        3. lift-+.f64N/A

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{\color{blue}{x + 1}}} \]
        4. lift-sqrt.f64N/A

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x} \cdot \color{blue}{\sqrt{x + 1}}} \]
        5. sqrt-prodN/A

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

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

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

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{\color{blue}{x \cdot \left(x + 1\right)}}} \]
        9. distribute-lft-inN/A

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{\color{blue}{x \cdot x + x \cdot 1}}} \]
        10. rem-square-sqrtN/A

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x \cdot x + \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot 1}} \]
        11. pow2N/A

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

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x \cdot x + {\left(\sqrt{x}\right)}^{2} \cdot \color{blue}{{1}^{2}}}} \]
        13. unpow-prod-downN/A

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x \cdot x + \color{blue}{{\left(\sqrt{x} \cdot 1\right)}^{2}}}} \]
        14. *-rgt-identityN/A

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x \cdot x + {\color{blue}{\left(\sqrt{x}\right)}}^{2}}} \]
        15. pow2N/A

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x \cdot x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}}} \]
        16. rem-square-sqrtN/A

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x \cdot x + \color{blue}{x}}} \]
        17. lower-fma.f6499.5

          \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{\color{blue}{\mathsf{fma}\left(x, x, x\right)}}} \]
      3. Applied rewrites99.5%

        \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\color{blue}{\sqrt{\mathsf{fma}\left(x, x, x\right)}}} \]

      if 9.9999999999999999e51 < x

      1. Initial program 42.1%

        \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
      2. Taylor expanded in x around inf

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

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

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

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

          \[\leadsto \frac{\frac{1}{2} \cdot \sqrt{x}}{x \cdot x} \]
        2. lift-sqrt.f6479.3

          \[\leadsto \frac{0.5 \cdot \sqrt{x}}{x \cdot x} \]
      7. Applied rewrites79.3%

        \[\leadsto \frac{0.5 \cdot \sqrt{x}}{\color{blue}{x} \cdot x} \]
      8. Step-by-step derivation
        1. lift-*.f64N/A

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

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

          \[\leadsto \frac{\frac{\frac{1}{2} \cdot \sqrt{x}}{x}}{\color{blue}{x}} \]
        4. lower-/.f64N/A

          \[\leadsto \frac{\frac{\frac{1}{2} \cdot \sqrt{x}}{x}}{\color{blue}{x}} \]
      9. Applied rewrites99.7%

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

    Alternative 2: 99.2% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{x + 1}\\ \frac{\frac{1}{t\_0 + \sqrt{x}}}{\sqrt{x} \cdot t\_0} \end{array} \end{array} \]
    (FPCore (x)
     :precision binary64
     (let* ((t_0 (sqrt (+ x 1.0)))) (/ (/ 1.0 (+ t_0 (sqrt x))) (* (sqrt x) t_0))))
    double code(double x) {
    	double t_0 = sqrt((x + 1.0));
    	return (1.0 / (t_0 + sqrt(x))) / (sqrt(x) * t_0);
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(x)
    use fmin_fmax_functions
        real(8), intent (in) :: x
        real(8) :: t_0
        t_0 = sqrt((x + 1.0d0))
        code = (1.0d0 / (t_0 + sqrt(x))) / (sqrt(x) * t_0)
    end function
    
    public static double code(double x) {
    	double t_0 = Math.sqrt((x + 1.0));
    	return (1.0 / (t_0 + Math.sqrt(x))) / (Math.sqrt(x) * t_0);
    }
    
    def code(x):
    	t_0 = math.sqrt((x + 1.0))
    	return (1.0 / (t_0 + math.sqrt(x))) / (math.sqrt(x) * t_0)
    
    function code(x)
    	t_0 = sqrt(Float64(x + 1.0))
    	return Float64(Float64(1.0 / Float64(t_0 + sqrt(x))) / Float64(sqrt(x) * t_0))
    end
    
    function tmp = code(x)
    	t_0 = sqrt((x + 1.0));
    	tmp = (1.0 / (t_0 + sqrt(x))) / (sqrt(x) * t_0);
    end
    
    code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(1.0 / N[(t$95$0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \sqrt{x + 1}\\
    \frac{\frac{1}{t\_0 + \sqrt{x}}}{\sqrt{x} \cdot t\_0}
    \end{array}
    \end{array}
    
    Derivation
    1. Initial program 38.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}} \]
      2. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
      3. lift-sqrt.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
      4. lift-/.f64N/A

        \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}}} \]
      5. lift-+.f64N/A

        \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{\color{blue}{x + 1}}} \]
      6. lift-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\sqrt{x + 1}}} \]
      7. frac-subN/A

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      9. lower--.f64N/A

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      10. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      11. lift-sqrt.f64N/A

        \[\leadsto \frac{1 \cdot \color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      12. lift-+.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      14. lift-sqrt.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      15. lower-*.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      16. lift-sqrt.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x}} \cdot \sqrt{x + 1}} \]
      17. lift-sqrt.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \color{blue}{\sqrt{x + 1}}} \]
      18. lift-+.f6438.7

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{\color{blue}{x + 1}}} \]
    3. Applied rewrites38.7%

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

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

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      3. lift-+.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      4. lift-sqrt.f64N/A

        \[\leadsto \frac{1 \cdot \color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      6. lift-sqrt.f64N/A

        \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      7. flip--N/A

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    7. Step-by-step derivation
      1. Applied rewrites99.2%

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

      Alternative 3: 99.6% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 2 \cdot 10^{+30}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(x, x, x\right)} \cdot \left(\sqrt{x + 1} + \sqrt{x}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.5 \cdot \sqrt{x}}{x}}{x}\\ \end{array} \end{array} \]
      (FPCore (x)
       :precision binary64
       (if (<= x 2e+30)
         (/ 1.0 (* (sqrt (fma x x x)) (+ (sqrt (+ x 1.0)) (sqrt x))))
         (/ (/ (* 0.5 (sqrt x)) x) x)))
      double code(double x) {
      	double tmp;
      	if (x <= 2e+30) {
      		tmp = 1.0 / (sqrt(fma(x, x, x)) * (sqrt((x + 1.0)) + sqrt(x)));
      	} else {
      		tmp = ((0.5 * sqrt(x)) / x) / x;
      	}
      	return tmp;
      }
      
      function code(x)
      	tmp = 0.0
      	if (x <= 2e+30)
      		tmp = Float64(1.0 / Float64(sqrt(fma(x, x, x)) * Float64(sqrt(Float64(x + 1.0)) + sqrt(x))));
      	else
      		tmp = Float64(Float64(Float64(0.5 * sqrt(x)) / x) / x);
      	end
      	return tmp
      end
      
      code[x_] := If[LessEqual[x, 2e+30], N[(1.0 / N[(N[Sqrt[N[(x * x + x), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq 2 \cdot 10^{+30}:\\
      \;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(x, x, x\right)} \cdot \left(\sqrt{x + 1} + \sqrt{x}\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{0.5 \cdot \sqrt{x}}{x}}{x}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < 2e30

        1. Initial program 34.2%

          \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
        2. Step-by-step derivation
          1. lift--.f64N/A

            \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}} \]
          2. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
          3. lift-sqrt.f64N/A

            \[\leadsto \frac{1}{\color{blue}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
          4. lift-/.f64N/A

            \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}}} \]
          5. lift-+.f64N/A

            \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{\color{blue}{x + 1}}} \]
          6. lift-sqrt.f64N/A

            \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\sqrt{x + 1}}} \]
          7. frac-subN/A

            \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
          8. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
          9. lower--.f64N/A

            \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          10. lower-*.f64N/A

            \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          11. lift-sqrt.f64N/A

            \[\leadsto \frac{1 \cdot \color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          12. lift-+.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          13. lower-*.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          14. lift-sqrt.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          15. lower-*.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
          16. lift-sqrt.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x}} \cdot \sqrt{x + 1}} \]
          17. lift-sqrt.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \color{blue}{\sqrt{x + 1}}} \]
          18. lift-+.f6434.7

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{\color{blue}{x + 1}}} \]
        3. Applied rewrites34.7%

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

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

            \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          3. lift-+.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          4. lift-sqrt.f64N/A

            \[\leadsto \frac{1 \cdot \color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          5. lift-*.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          6. lift-sqrt.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          7. flip--N/A

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

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

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

          \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
        7. Step-by-step derivation
          1. Applied rewrites99.0%

            \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          2. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
            2. lift-/.f64N/A

              \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            3. lift-+.f64N/A

              \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x + 1} + \sqrt{x}}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            4. lift-+.f64N/A

              \[\leadsto \frac{\frac{1}{\sqrt{\color{blue}{x + 1}} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            5. lift-sqrt.f64N/A

              \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x + 1}} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            6. lift-sqrt.f64N/A

              \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \color{blue}{\sqrt{x}}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\color{blue}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
            8. lift-sqrt.f64N/A

              \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\color{blue}{\sqrt{x}} \cdot \sqrt{x + 1}} \]
            9. lift-+.f64N/A

              \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{\color{blue}{x + 1}}} \]
            10. lift-sqrt.f64N/A

              \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x} \cdot \color{blue}{\sqrt{x + 1}}} \]
            11. associate-/l/N/A

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

            \[\leadsto \color{blue}{\frac{1}{\sqrt{\mathsf{fma}\left(x, x, x\right)} \cdot \left(\sqrt{x + 1} + \sqrt{x}\right)}} \]

          if 2e30 < x

          1. Initial program 39.1%

            \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
          2. Taylor expanded in x around inf

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

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

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

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

              \[\leadsto \frac{\frac{1}{2} \cdot \sqrt{x}}{x \cdot x} \]
            2. lift-sqrt.f6480.9

              \[\leadsto \frac{0.5 \cdot \sqrt{x}}{x \cdot x} \]
          7. Applied rewrites80.9%

            \[\leadsto \frac{0.5 \cdot \sqrt{x}}{\color{blue}{x} \cdot x} \]
          8. Step-by-step derivation
            1. lift-*.f64N/A

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

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

              \[\leadsto \frac{\frac{\frac{1}{2} \cdot \sqrt{x}}{x}}{\color{blue}{x}} \]
            4. lower-/.f64N/A

              \[\leadsto \frac{\frac{\frac{1}{2} \cdot \sqrt{x}}{x}}{\color{blue}{x}} \]
          9. Applied rewrites99.7%

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

        Alternative 4: 97.7% accurate, 0.9× speedup?

        \[\begin{array}{l} \\ \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{-\left(-x\right)} \end{array} \]
        (FPCore (x)
         :precision binary64
         (/ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (- (- x))))
        double code(double x) {
        	return (1.0 / (sqrt((x + 1.0)) + sqrt(x))) / -(-x);
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(x)
        use fmin_fmax_functions
            real(8), intent (in) :: x
            code = (1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) / -(-x)
        end function
        
        public static double code(double x) {
        	return (1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) / -(-x);
        }
        
        def code(x):
        	return (1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) / -(-x)
        
        function code(x)
        	return Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) / Float64(-Float64(-x)))
        end
        
        function tmp = code(x)
        	tmp = (1.0 / (sqrt((x + 1.0)) + sqrt(x))) / -(-x);
        end
        
        code[x_] := N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-(-x))), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{-\left(-x\right)}
        \end{array}
        
        Derivation
        1. Initial program 38.6%

          \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
        2. Step-by-step derivation
          1. lift--.f64N/A

            \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}} \]
          2. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
          3. lift-sqrt.f64N/A

            \[\leadsto \frac{1}{\color{blue}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
          4. lift-/.f64N/A

            \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}}} \]
          5. lift-+.f64N/A

            \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{\color{blue}{x + 1}}} \]
          6. lift-sqrt.f64N/A

            \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\sqrt{x + 1}}} \]
          7. frac-subN/A

            \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
          8. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
          9. lower--.f64N/A

            \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          10. lower-*.f64N/A

            \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          11. lift-sqrt.f64N/A

            \[\leadsto \frac{1 \cdot \color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          12. lift-+.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          13. lower-*.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          14. lift-sqrt.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          15. lower-*.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
          16. lift-sqrt.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x}} \cdot \sqrt{x + 1}} \]
          17. lift-sqrt.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \color{blue}{\sqrt{x + 1}}} \]
          18. lift-+.f6438.7

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{\color{blue}{x + 1}}} \]
        3. Applied rewrites38.7%

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

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

            \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          3. lift-+.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          4. lift-sqrt.f64N/A

            \[\leadsto \frac{1 \cdot \color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          5. lift-*.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          6. lift-sqrt.f64N/A

            \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          7. flip--N/A

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

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

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

          \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
        7. Step-by-step derivation
          1. Applied rewrites99.2%

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

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

              \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\mathsf{neg}\left(x \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
            2. sqrt-pow2N/A

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

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

              \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\mathsf{neg}\left(x \cdot -1\right)} \]
            5. *-commutativeN/A

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

              \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)} \]
            7. lower-neg.f64N/A

              \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{-\left(\mathsf{neg}\left(x\right)\right)} \]
            8. lower-neg.f6497.7

              \[\leadsto \frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{-\left(-x\right)} \]
          4. Applied rewrites97.7%

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

          Alternative 5: 97.6% accurate, 1.3× speedup?

          \[\begin{array}{l} \\ \frac{\frac{0.5 \cdot \sqrt{x}}{x}}{x} \end{array} \]
          (FPCore (x) :precision binary64 (/ (/ (* 0.5 (sqrt x)) x) x))
          double code(double x) {
          	return ((0.5 * sqrt(x)) / x) / x;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              code = ((0.5d0 * sqrt(x)) / x) / x
          end function
          
          public static double code(double x) {
          	return ((0.5 * Math.sqrt(x)) / x) / x;
          }
          
          def code(x):
          	return ((0.5 * math.sqrt(x)) / x) / x
          
          function code(x)
          	return Float64(Float64(Float64(0.5 * sqrt(x)) / x) / x)
          end
          
          function tmp = code(x)
          	tmp = ((0.5 * sqrt(x)) / x) / x;
          end
          
          code[x_] := N[(N[(N[(0.5 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \frac{\frac{0.5 \cdot \sqrt{x}}{x}}{x}
          \end{array}
          
          Derivation
          1. Initial program 38.6%

            \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
          2. Taylor expanded in x around inf

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

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

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

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

              \[\leadsto \frac{\frac{1}{2} \cdot \sqrt{x}}{x \cdot x} \]
            2. lift-sqrt.f6480.6

              \[\leadsto \frac{0.5 \cdot \sqrt{x}}{x \cdot x} \]
          7. Applied rewrites80.6%

            \[\leadsto \frac{0.5 \cdot \sqrt{x}}{\color{blue}{x} \cdot x} \]
          8. Step-by-step derivation
            1. lift-*.f64N/A

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

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

              \[\leadsto \frac{\frac{\frac{1}{2} \cdot \sqrt{x}}{x}}{\color{blue}{x}} \]
            4. lower-/.f64N/A

              \[\leadsto \frac{\frac{\frac{1}{2} \cdot \sqrt{x}}{x}}{\color{blue}{x}} \]
          9. Applied rewrites97.6%

            \[\leadsto \frac{\frac{0.5 \cdot \sqrt{x}}{x}}{\color{blue}{x}} \]
          10. Add Preprocessing

          Alternative 6: 97.6% accurate, 1.5× speedup?

          \[\begin{array}{l} \\ \frac{\frac{0.5}{\sqrt{x}}}{x} \end{array} \]
          (FPCore (x) :precision binary64 (/ (/ 0.5 (sqrt x)) x))
          double code(double x) {
          	return (0.5 / sqrt(x)) / x;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              code = (0.5d0 / sqrt(x)) / x
          end function
          
          public static double code(double x) {
          	return (0.5 / Math.sqrt(x)) / x;
          }
          
          def code(x):
          	return (0.5 / math.sqrt(x)) / x
          
          function code(x)
          	return Float64(Float64(0.5 / sqrt(x)) / x)
          end
          
          function tmp = code(x)
          	tmp = (0.5 / sqrt(x)) / x;
          end
          
          code[x_] := N[(N[(0.5 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \frac{\frac{0.5}{\sqrt{x}}}{x}
          \end{array}
          
          Derivation
          1. Initial program 38.6%

            \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
          2. Taylor expanded in x around inf

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

              \[\leadsto \frac{\frac{-1}{2} \cdot \sqrt{\frac{1}{x}} - \frac{-1}{2} \cdot \sqrt{x}}{\color{blue}{{x}^{2}}} \]
            2. distribute-lft-out--N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)}{{\color{blue}{x}}^{2}} \]
            3. lower-*.f64N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)}{{\color{blue}{x}}^{2}} \]
            4. lower--.f64N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)}{{x}^{2}} \]
            5. sqrt-divN/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left(\frac{\sqrt{1}}{\sqrt{x}} - \sqrt{x}\right)}{{x}^{2}} \]
            6. metadata-evalN/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left(\frac{1}{\sqrt{x}} - \sqrt{x}\right)}{{x}^{2}} \]
            7. inv-powN/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{{x}^{2}} \]
            8. lower-pow.f64N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{{x}^{2}} \]
            9. lift-sqrt.f64N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{{x}^{2}} \]
            10. lift-sqrt.f64N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{{x}^{2}} \]
            11. unpow2N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{x \cdot \color{blue}{x}} \]
            12. lower-*.f6480.7

              \[\leadsto \frac{-0.5 \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{x \cdot \color{blue}{x}} \]
          4. Applied rewrites80.7%

            \[\leadsto \color{blue}{\frac{-0.5 \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{x \cdot x}} \]
          5. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{\color{blue}{x \cdot x}} \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{\color{blue}{x} \cdot x} \]
            3. lift--.f64N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{x \cdot x} \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{x \cdot x} \]
            5. lift-sqrt.f64N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{x \cdot x} \]
            6. lift-sqrt.f64N/A

              \[\leadsto \frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{x \cdot x} \]
            7. lift-*.f64N/A

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

              \[\leadsto \frac{\frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{x}}{\color{blue}{x}} \]
            9. lower-/.f64N/A

              \[\leadsto \frac{\frac{\frac{-1}{2} \cdot \left({\left(\sqrt{x}\right)}^{-1} - \sqrt{x}\right)}{x}}{\color{blue}{x}} \]
          6. Applied rewrites97.7%

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

            \[\leadsto \frac{\frac{1}{2} \cdot \sqrt{\frac{1}{x}}}{x} \]
          8. Step-by-step derivation
            1. sqrt-divN/A

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

              \[\leadsto \frac{\frac{1}{2} \cdot \frac{1}{\sqrt{x}}}{x} \]
            3. associate-*r/N/A

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

              \[\leadsto \frac{\frac{\frac{1}{2}}{\sqrt{x}}}{x} \]
            5. lower-/.f64N/A

              \[\leadsto \frac{\frac{\frac{1}{2}}{\sqrt{x}}}{x} \]
            6. lift-sqrt.f6497.6

              \[\leadsto \frac{\frac{0.5}{\sqrt{x}}}{x} \]
          9. Applied rewrites97.6%

            \[\leadsto \frac{\frac{0.5}{\sqrt{x}}}{x} \]
          10. Add Preprocessing

          Alternative 7: 80.6% accurate, 1.5× speedup?

          \[\begin{array}{l} \\ \frac{0.5 \cdot \sqrt{x}}{x \cdot x} \end{array} \]
          (FPCore (x) :precision binary64 (/ (* 0.5 (sqrt x)) (* x x)))
          double code(double x) {
          	return (0.5 * sqrt(x)) / (x * x);
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              code = (0.5d0 * sqrt(x)) / (x * x)
          end function
          
          public static double code(double x) {
          	return (0.5 * Math.sqrt(x)) / (x * x);
          }
          
          def code(x):
          	return (0.5 * math.sqrt(x)) / (x * x)
          
          function code(x)
          	return Float64(Float64(0.5 * sqrt(x)) / Float64(x * x))
          end
          
          function tmp = code(x)
          	tmp = (0.5 * sqrt(x)) / (x * x);
          end
          
          code[x_] := N[(N[(0.5 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \frac{0.5 \cdot \sqrt{x}}{x \cdot x}
          \end{array}
          
          Derivation
          1. Initial program 38.6%

            \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
          2. Taylor expanded in x around inf

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

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

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

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

              \[\leadsto \frac{\frac{1}{2} \cdot \sqrt{x}}{x \cdot x} \]
            2. lift-sqrt.f6480.6

              \[\leadsto \frac{0.5 \cdot \sqrt{x}}{x \cdot x} \]
          7. Applied rewrites80.6%

            \[\leadsto \frac{0.5 \cdot \sqrt{x}}{\color{blue}{x} \cdot x} \]
          8. Add Preprocessing

          Alternative 8: 36.2% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \frac{\left(x + 1\right) - x}{\sqrt{x} + x} \end{array} \]
          (FPCore (x) :precision binary64 (/ (- (+ x 1.0) x) (+ (sqrt x) x)))
          double code(double x) {
          	return ((x + 1.0) - x) / (sqrt(x) + x);
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              code = ((x + 1.0d0) - x) / (sqrt(x) + x)
          end function
          
          public static double code(double x) {
          	return ((x + 1.0) - x) / (Math.sqrt(x) + x);
          }
          
          def code(x):
          	return ((x + 1.0) - x) / (math.sqrt(x) + x)
          
          function code(x)
          	return Float64(Float64(Float64(x + 1.0) - x) / Float64(sqrt(x) + x))
          end
          
          function tmp = code(x)
          	tmp = ((x + 1.0) - x) / (sqrt(x) + x);
          end
          
          code[x_] := N[(N[(N[(x + 1.0), $MachinePrecision] - x), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \frac{\left(x + 1\right) - x}{\sqrt{x} + x}
          \end{array}
          
          Derivation
          1. Initial program 38.6%

            \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
          2. Step-by-step derivation
            1. lift-/.f64N/A

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

              \[\leadsto \frac{\color{blue}{\sqrt{1}}}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
            3. lift-sqrt.f64N/A

              \[\leadsto \frac{\sqrt{1}}{\color{blue}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
            4. sqrt-divN/A

              \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} - \frac{1}{\sqrt{x + 1}} \]
            5. lower-sqrt.f64N/A

              \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} - \frac{1}{\sqrt{x + 1}} \]
            6. inv-powN/A

              \[\leadsto \sqrt{\color{blue}{{x}^{-1}}} - \frac{1}{\sqrt{x + 1}} \]
            7. lower-pow.f6429.7

              \[\leadsto \sqrt{\color{blue}{{x}^{-1}}} - \frac{1}{\sqrt{x + 1}} \]
          3. Applied rewrites29.7%

            \[\leadsto \color{blue}{\sqrt{{x}^{-1}}} - \frac{1}{\sqrt{x + 1}} \]
          4. Step-by-step derivation
            1. lift-pow.f64N/A

              \[\leadsto \sqrt{\color{blue}{{x}^{-1}}} - \frac{1}{\sqrt{x + 1}} \]
            2. inv-powN/A

              \[\leadsto \sqrt{\color{blue}{\frac{1}{x}}} - \frac{1}{\sqrt{x + 1}} \]
            3. lower-/.f6429.7

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

            \[\leadsto \sqrt{\color{blue}{\frac{1}{x}}} - \frac{1}{\sqrt{x + 1}} \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} - \frac{1}{\sqrt{x + 1}}} \]
            2. lift-/.f64N/A

              \[\leadsto \sqrt{\color{blue}{\frac{1}{x}}} - \frac{1}{\sqrt{x + 1}} \]
            3. lift-sqrt.f64N/A

              \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} - \frac{1}{\sqrt{x + 1}} \]
            4. lift-/.f64N/A

              \[\leadsto \sqrt{\frac{1}{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}}} \]
            5. lift-+.f64N/A

              \[\leadsto \sqrt{\frac{1}{x}} - \frac{1}{\sqrt{\color{blue}{x + 1}}} \]
            6. lift-sqrt.f64N/A

              \[\leadsto \sqrt{\frac{1}{x}} - \frac{1}{\color{blue}{\sqrt{x + 1}}} \]
            7. sqrt-divN/A

              \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
            8. metadata-evalN/A

              \[\leadsto \frac{\color{blue}{1}}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
            9. frac-subN/A

              \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
            10. div-subN/A

              \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1}}{\sqrt{x} \cdot \sqrt{x + 1}} - \frac{\sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
            11. *-lft-identityN/A

              \[\leadsto \frac{\color{blue}{\sqrt{x + 1}}}{\sqrt{x} \cdot \sqrt{x + 1}} - \frac{\sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            12. *-rgt-identityN/A

              \[\leadsto \frac{\sqrt{x + 1}}{\sqrt{x} \cdot \sqrt{x + 1}} - \frac{\color{blue}{\sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            13. div-subN/A

              \[\leadsto \color{blue}{\frac{\sqrt{x + 1} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
            14. flip--N/A

              \[\leadsto \frac{\color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
          7. Applied rewrites40.7%

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

            \[\leadsto \frac{\left(x + 1\right) - x}{\color{blue}{\sqrt{x} \cdot \left(1 + \sqrt{x}\right)}} \]
          9. Step-by-step derivation
            1. distribute-lft-inN/A

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

              \[\leadsto \frac{\left(x + 1\right) - x}{\sqrt{x} + \color{blue}{\sqrt{x}} \cdot \sqrt{x}} \]
            3. rem-square-sqrtN/A

              \[\leadsto \frac{\left(x + 1\right) - x}{\sqrt{x} + x} \]
            4. lower-+.f64N/A

              \[\leadsto \frac{\left(x + 1\right) - x}{\sqrt{x} + \color{blue}{x}} \]
            5. lift-sqrt.f6436.2

              \[\leadsto \frac{\left(x + 1\right) - x}{\sqrt{x} + x} \]
          10. Applied rewrites36.2%

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

          Alternative 9: 35.7% accurate, 49.0× speedup?

          \[\begin{array}{l} \\ 0 \end{array} \]
          (FPCore (x) :precision binary64 0.0)
          double code(double x) {
          	return 0.0;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x)
          use fmin_fmax_functions
              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 38.6%

            \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
          2. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}} \]
            2. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
            3. lift-sqrt.f64N/A

              \[\leadsto \frac{1}{\color{blue}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
            4. lift-/.f64N/A

              \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}}} \]
            5. lift-+.f64N/A

              \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{\color{blue}{x + 1}}} \]
            6. lift-sqrt.f64N/A

              \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\sqrt{x + 1}}} \]
            7. frac-subN/A

              \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
            8. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
            9. lower--.f64N/A

              \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            11. lift-sqrt.f64N/A

              \[\leadsto \frac{1 \cdot \color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            12. lift-+.f64N/A

              \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            13. lower-*.f64N/A

              \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            14. lift-sqrt.f64N/A

              \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            15. lower-*.f64N/A

              \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
            16. lift-sqrt.f64N/A

              \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{x}} \cdot \sqrt{x + 1}} \]
            17. lift-sqrt.f64N/A

              \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \color{blue}{\sqrt{x + 1}}} \]
            18. lift-+.f6438.7

              \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{\color{blue}{x + 1}}} \]
          3. Applied rewrites38.7%

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

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

              \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            3. lift-+.f64N/A

              \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            4. lift-sqrt.f64N/A

              \[\leadsto \frac{1 \cdot \color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            5. lift-*.f64N/A

              \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x} \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            6. lift-sqrt.f64N/A

              \[\leadsto \frac{1 \cdot \sqrt{x + 1} - \color{blue}{\sqrt{x}} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
            7. flip--N/A

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

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

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

            \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(\sqrt{\frac{1}{x}} \cdot \left(1 + {\left(\sqrt{-1}\right)}^{2}\right)\right)} \]
          7. Step-by-step derivation
            1. associate-*r*N/A

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

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

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

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

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

              \[\leadsto \frac{\frac{1}{2}}{\sqrt{x}} \cdot \left(1 + {\left(\sqrt{-1}\right)}^{2}\right) \]
            7. lower-/.f64N/A

              \[\leadsto \frac{\frac{1}{2}}{\sqrt{x}} \cdot \left(\color{blue}{1} + {\left(\sqrt{-1}\right)}^{2}\right) \]
            8. lift-sqrt.f64N/A

              \[\leadsto \frac{\frac{1}{2}}{\sqrt{x}} \cdot \left(1 + {\left(\sqrt{-1}\right)}^{2}\right) \]
            9. sqrt-pow2N/A

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

              \[\leadsto \frac{\frac{1}{2}}{\sqrt{x}} \cdot \left(1 + {-1}^{1}\right) \]
            11. metadata-evalN/A

              \[\leadsto \frac{\frac{1}{2}}{\sqrt{x}} \cdot \left(1 + -1\right) \]
            12. metadata-eval35.7

              \[\leadsto \frac{0.5}{\sqrt{x}} \cdot 0 \]
          8. Applied rewrites35.7%

            \[\leadsto \color{blue}{\frac{0.5}{\sqrt{x}} \cdot 0} \]
          9. Taylor expanded in x around 0

            \[\leadsto 0 \]
          10. Step-by-step derivation
            1. Applied rewrites35.7%

              \[\leadsto 0 \]
            2. Add Preprocessing

            Developer Target 1: 38.6% accurate, 0.2× speedup?

            \[\begin{array}{l} \\ {x}^{-0.5} - {\left(x + 1\right)}^{-0.5} \end{array} \]
            (FPCore (x) :precision binary64 (- (pow x -0.5) (pow (+ x 1.0) -0.5)))
            double code(double x) {
            	return pow(x, -0.5) - pow((x + 1.0), -0.5);
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                code = (x ** (-0.5d0)) - ((x + 1.0d0) ** (-0.5d0))
            end function
            
            public static double code(double x) {
            	return Math.pow(x, -0.5) - Math.pow((x + 1.0), -0.5);
            }
            
            def code(x):
            	return math.pow(x, -0.5) - math.pow((x + 1.0), -0.5)
            
            function code(x)
            	return Float64((x ^ -0.5) - (Float64(x + 1.0) ^ -0.5))
            end
            
            function tmp = code(x)
            	tmp = (x ^ -0.5) - ((x + 1.0) ^ -0.5);
            end
            
            code[x_] := N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            {x}^{-0.5} - {\left(x + 1\right)}^{-0.5}
            \end{array}
            

            Reproduce

            ?
            herbie shell --seed 2025092 
            (FPCore (x)
              :name "2isqrt (example 3.6)"
              :precision binary64
              :pre (and (> x 1.0) (< x 1e+308))
            
              :alt
              (! :herbie-platform default (- (pow x -1/2) (pow (+ x 1) -1/2)))
            
              (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))