Average Error: 20.0 → 10.7
Time: 1.5m
Precision: 64
Internal Precision: 1088
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\begin{array}{l} \mathbf{if}\;x \le 7206.423390424425:\\ \;\;\;\;{x}^{\frac{-1}{2}} - \frac{1}{\sqrt{1 + x}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{2} \cdot \sqrt{\frac{1}{{x}^{3}}} + \sqrt{\frac{1}{{x}^{7}}} \cdot \frac{5}{16}\right) - \sqrt{\frac{1}{{x}^{5}}} \cdot \frac{3}{8}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original20.0
Target0.7
Herbie10.7
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}\]

Derivation

  1. Split input into 2 regimes
  2. if x < 7206.423390424425

    1. Initial program 0.4

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

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

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

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

    if 7206.423390424425 < x

    1. Initial program 40.0

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

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

      \[\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-squares40.0

      \[\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. Taylor expanded around inf 21.6

      \[\leadsto \color{blue}{\left(\frac{5}{16} \cdot \sqrt{\frac{1}{{x}^{7}}} + \frac{1}{2} \cdot \sqrt{\frac{1}{{x}^{3}}}\right) - \frac{3}{8} \cdot \sqrt{\frac{1}{{x}^{5}}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification10.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 7206.423390424425:\\ \;\;\;\;{x}^{\frac{-1}{2}} - \frac{1}{\sqrt{1 + x}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{2} \cdot \sqrt{\frac{1}{{x}^{3}}} + \sqrt{\frac{1}{{x}^{7}}} \cdot \frac{5}{16}\right) - \sqrt{\frac{1}{{x}^{5}}} \cdot \frac{3}{8}\\ \end{array}\]

Runtime

Time bar (total: 1.5m)Debug logProfile

BaselineHerbieOracleSpan%
Regimes22.410.710.711.799.6%
herbie shell --seed 2018339 +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)))))