Average Error: 20.4 → 20.2
Time: 2.8m
Precision: 64
Internal Precision: 1088
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\begin{array}{l} \mathbf{if}\;x \le 2.189371705821168 \cdot 10^{+73}:\\ \;\;\;\;{x}^{\frac{-1}{2}} - \sqrt{\frac{1}{\sqrt{1 + x}}} \cdot \sqrt{\frac{1}{\sqrt{1 + x}}}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\left(\sqrt{\frac{1}{\sqrt{x}}} + \sqrt{\frac{1}{\sqrt{1 + x}}}\right) \cdot \left(\sqrt{\frac{1}{\sqrt{x}}} - \sqrt{\frac{1}{\sqrt{1 + x}}}\right)\right)}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original20.4
Target0.7
Herbie20.2
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}\]

Derivation

  1. Split input into 2 regimes
  2. if x < 2.189371705821168e+73

    1. Initial program 10.2

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
    2. Using strategy rm
    3. Applied pow1/210.2

      \[\leadsto \frac{1}{\color{blue}{{x}^{\frac{1}{2}}}} - \frac{1}{\sqrt{x + 1}}\]
    4. Applied pow-flip9.9

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

      \[\leadsto {x}^{\color{blue}{\frac{-1}{2}}} - \frac{1}{\sqrt{x + 1}}\]
    6. Using strategy rm
    7. Applied add-sqr-sqrt9.9

      \[\leadsto {x}^{\frac{-1}{2}} - \color{blue}{\sqrt{\frac{1}{\sqrt{x + 1}}} \cdot \sqrt{\frac{1}{\sqrt{x + 1}}}}\]

    if 2.189371705821168e+73 < x

    1. Initial program 36.2

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt48.4

      \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{\sqrt{\frac{1}{\sqrt{x + 1}}} \cdot \sqrt{\frac{1}{\sqrt{x + 1}}}}\]
    4. Applied add-sqr-sqrt36.2

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\sqrt{x}}} \cdot \sqrt{\frac{1}{\sqrt{x}}}} - \sqrt{\frac{1}{\sqrt{x + 1}}} \cdot \sqrt{\frac{1}{\sqrt{x + 1}}}\]
    5. Applied difference-of-squares36.2

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{\sqrt{x}}} + \sqrt{\frac{1}{\sqrt{x + 1}}}\right) \cdot \left(\sqrt{\frac{1}{\sqrt{x}}} - \sqrt{\frac{1}{\sqrt{x + 1}}}\right)}\]
    6. Using strategy rm
    7. Applied add-exp-log36.2

      \[\leadsto \color{blue}{e^{\log \left(\left(\sqrt{\frac{1}{\sqrt{x}}} + \sqrt{\frac{1}{\sqrt{x + 1}}}\right) \cdot \left(\sqrt{\frac{1}{\sqrt{x}}} - \sqrt{\frac{1}{\sqrt{x + 1}}}\right)\right)}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification20.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 2.189371705821168 \cdot 10^{+73}:\\ \;\;\;\;{x}^{\frac{-1}{2}} - \sqrt{\frac{1}{\sqrt{1 + x}}} \cdot \sqrt{\frac{1}{\sqrt{1 + x}}}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\left(\sqrt{\frac{1}{\sqrt{x}}} + \sqrt{\frac{1}{\sqrt{1 + x}}}\right) \cdot \left(\sqrt{\frac{1}{\sqrt{x}}} - \sqrt{\frac{1}{\sqrt{1 + x}}}\right)\right)}\\ \end{array}\]

Runtime

Time bar (total: 2.8m)Debug logProfile

herbie shell --seed 2018248 +o rules:numerics
(FPCore (x)
  :name "2isqrt (example 3.6)"

  :herbie-target
  (/ 1 (+ (* (+ x 1) (sqrt x)) (* x (sqrt (+ x 1)))))

  (- (/ 1 (sqrt x)) (/ 1 (sqrt (+ x 1)))))