sqrt(x + 39) - sqrt(x)

Percentage Accurate: 53.2% → 99.8%
Time: 4.0s
Alternatives: 5
Speedup: 0.7×

Specification

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

\\
\sqrt{x + 39} - \sqrt{x}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

\\
\sqrt{x + 39} - \sqrt{x}
\end{array}

Alternative 1: 99.8% accurate, 0.7× speedup?

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

\\
\frac{39}{\sqrt{x} + \sqrt{39 + x}}
\end{array}
Derivation
  1. Initial program 53.7%

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

      \[\leadsto \color{blue}{\sqrt{x + 39} - \sqrt{x}} \]
    2. flip--N/A

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\left(x + 39\right) - x}}{\sqrt{x + 39} + \sqrt{x}} \]
    11. lift-+.f64N/A

      \[\leadsto \frac{\color{blue}{\left(x + 39\right)} - x}{\sqrt{x + 39} + \sqrt{x}} \]
    12. +-commutativeN/A

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

      \[\leadsto \frac{\color{blue}{\left(39 + x\right)} - x}{\sqrt{x + 39} + \sqrt{x}} \]
    14. +-commutativeN/A

      \[\leadsto \frac{\left(39 + x\right) - x}{\color{blue}{\sqrt{x} + \sqrt{x + 39}}} \]
    15. lower-+.f6454.5

      \[\leadsto \frac{\left(39 + x\right) - x}{\color{blue}{\sqrt{x} + \sqrt{x + 39}}} \]
    16. lift-+.f64N/A

      \[\leadsto \frac{\left(39 + x\right) - x}{\sqrt{x} + \sqrt{\color{blue}{x + 39}}} \]
    17. +-commutativeN/A

      \[\leadsto \frac{\left(39 + x\right) - x}{\sqrt{x} + \sqrt{\color{blue}{39 + x}}} \]
    18. lower-+.f6454.5

      \[\leadsto \frac{\left(39 + x\right) - x}{\sqrt{x} + \sqrt{\color{blue}{39 + x}}} \]
  4. Applied rewrites54.5%

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

    \[\leadsto \frac{\color{blue}{39}}{\sqrt{x} + \sqrt{39 + x}} \]
  6. Step-by-step derivation
    1. Applied rewrites99.8%

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

    Alternative 2: 99.4% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{x + 39} - \sqrt{x}\\ \mathbf{if}\;t\_0 \leq 0.0001:\\ \;\;\;\;\frac{19.5}{\sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x)
     :precision binary64
     (let* ((t_0 (- (sqrt (+ x 39.0)) (sqrt x))))
       (if (<= t_0 0.0001) (/ 19.5 (sqrt x)) t_0)))
    double code(double x) {
    	double t_0 = sqrt((x + 39.0)) - sqrt(x);
    	double tmp;
    	if (t_0 <= 0.0001) {
    		tmp = 19.5 / sqrt(x);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(x)
        real(8), intent (in) :: x
        real(8) :: t_0
        real(8) :: tmp
        t_0 = sqrt((x + 39.0d0)) - sqrt(x)
        if (t_0 <= 0.0001d0) then
            tmp = 19.5d0 / sqrt(x)
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double x) {
    	double t_0 = Math.sqrt((x + 39.0)) - Math.sqrt(x);
    	double tmp;
    	if (t_0 <= 0.0001) {
    		tmp = 19.5 / Math.sqrt(x);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x):
    	t_0 = math.sqrt((x + 39.0)) - math.sqrt(x)
    	tmp = 0
    	if t_0 <= 0.0001:
    		tmp = 19.5 / math.sqrt(x)
    	else:
    		tmp = t_0
    	return tmp
    
    function code(x)
    	t_0 = Float64(sqrt(Float64(x + 39.0)) - sqrt(x))
    	tmp = 0.0
    	if (t_0 <= 0.0001)
    		tmp = Float64(19.5 / sqrt(x));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x)
    	t_0 = sqrt((x + 39.0)) - sqrt(x);
    	tmp = 0.0;
    	if (t_0 <= 0.0001)
    		tmp = 19.5 / sqrt(x);
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_] := Block[{t$95$0 = N[(N[Sqrt[N[(x + 39.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0001], N[(19.5 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision], t$95$0]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \sqrt{x + 39} - \sqrt{x}\\
    \mathbf{if}\;t\_0 \leq 0.0001:\\
    \;\;\;\;\frac{19.5}{\sqrt{x}}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (-.f64 (sqrt.f64 (+.f64 x #s(literal 39 binary64))) (sqrt.f64 x)) < 1.00000000000000005e-4

      1. Initial program 4.8%

        \[\sqrt{x + 39} - \sqrt{x} \]
      2. Add Preprocessing
      3. Taylor expanded in x around inf

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

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

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

          \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \cdot \frac{39}{2} \]
        4. lower-/.f6499.0

          \[\leadsto \sqrt{\color{blue}{\frac{1}{x}}} \cdot 19.5 \]
      5. Applied rewrites99.0%

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

          \[\leadsto \color{blue}{\frac{19.5}{\sqrt{x}}} \]

        if 1.00000000000000005e-4 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 39 binary64))) (sqrt.f64 x))

        1. Initial program 99.7%

          \[\sqrt{x + 39} - \sqrt{x} \]
        2. Add Preprocessing
      7. Recombined 2 regimes into one program.
      8. Add Preprocessing

      Alternative 3: 97.5% accurate, 0.5× speedup?

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

        1. Initial program 5.2%

          \[\sqrt{x + 39} - \sqrt{x} \]
        2. Add Preprocessing
        3. Taylor expanded in x around inf

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

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

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

            \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \cdot \frac{39}{2} \]
          4. lower-/.f6498.6

            \[\leadsto \sqrt{\color{blue}{\frac{1}{x}}} \cdot 19.5 \]
        5. Applied rewrites98.6%

          \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} \cdot 19.5} \]
        6. Step-by-step derivation
          1. Applied rewrites98.8%

            \[\leadsto \color{blue}{\frac{19.5}{\sqrt{x}}} \]

          if 1e-3 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 39 binary64))) (sqrt.f64 x))

          1. Initial program 100.0%

            \[\sqrt{x + 39} - \sqrt{x} \]
          2. Add Preprocessing
          3. Taylor expanded in x around 0

            \[\leadsto \sqrt{\color{blue}{39}} - \sqrt{x} \]
          4. Step-by-step derivation
            1. Applied rewrites98.3%

              \[\leadsto \sqrt{\color{blue}{39}} - \sqrt{x} \]
          5. Recombined 2 regimes into one program.
          6. Add Preprocessing

          Alternative 4: 52.4% accurate, 1.2× speedup?

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

            \[\sqrt{x + 39} - \sqrt{x} \]
          2. Add Preprocessing
          3. Taylor expanded in x around inf

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

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

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

              \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \cdot \frac{39}{2} \]
            4. lower-/.f6451.7

              \[\leadsto \sqrt{\color{blue}{\frac{1}{x}}} \cdot 19.5 \]
          5. Applied rewrites51.7%

            \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} \cdot 19.5} \]
          6. Step-by-step derivation
            1. Applied rewrites51.8%

              \[\leadsto \color{blue}{\frac{19.5}{\sqrt{x}}} \]
            2. Add Preprocessing

            Alternative 5: 2.9% accurate, 2.3× speedup?

            \[\begin{array}{l} \\ \frac{39}{0} \end{array} \]
            (FPCore (x) :precision binary64 (/ 39.0 0.0))
            double code(double x) {
            	return 39.0 / 0.0;
            }
            
            real(8) function code(x)
                real(8), intent (in) :: x
                code = 39.0d0 / 0.0d0
            end function
            
            public static double code(double x) {
            	return 39.0 / 0.0;
            }
            
            def code(x):
            	return 39.0 / 0.0
            
            function code(x)
            	return Float64(39.0 / 0.0)
            end
            
            function tmp = code(x)
            	tmp = 39.0 / 0.0;
            end
            
            code[x_] := N[(39.0 / 0.0), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \frac{39}{0}
            \end{array}
            
            Derivation
            1. Initial program 53.7%

              \[\sqrt{x + 39} - \sqrt{x} \]
            2. Add Preprocessing
            3. Applied rewrites53.5%

              \[\leadsto \color{blue}{\frac{\left(39 + x\right) - x}{\mathsf{fma}\left(\sqrt{x}, x, {\left(39 + x\right)}^{1.5}\right)} \cdot \left(\left(\left(39 + x\right) + x\right) - \sqrt{\left(39 + x\right) \cdot x}\right)} \]
            4. Taylor expanded in x around -inf

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

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

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

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

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

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

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

                \[\leadsto \frac{39}{x \cdot \left(\color{blue}{0} \cdot \left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)} \]
              8. mul0-lftN/A

                \[\leadsto \frac{39}{x \cdot \color{blue}{0}} \]
              9. mul0-rgtN/A

                \[\leadsto \frac{39}{\color{blue}{0}} \]
              10. lower-/.f642.9

                \[\leadsto \color{blue}{\frac{39}{0}} \]
            6. Applied rewrites2.9%

              \[\leadsto \color{blue}{\frac{39}{0}} \]
            7. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 1 
            (FPCore (x)
              :name "sqrt(x + 39) - sqrt(x)"
              :precision binary64
              :pre (and (<= -1.79e+308 x) (<= x 1.79e+308))
              (- (sqrt (+ x 39.0)) (sqrt x)))