Average Error: 19.5 → 19.3
Time: 7.8s
Precision: 64
Internal precision: 1152
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\begin{array}{l} \mathbf{if}\;x \le 2.15158504903766 \cdot 10^{+100}:\\ \;\;\;\;\frac{1}{\sqrt{x}} - \sqrt[3]{\frac{\frac{1}{x + 1}}{\sqrt{x + 1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{1}{x + 1}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}\\ \end{array}\]

Error

Bits error versus x

Target

Original19.5
Comparison0.7
Herbie19.3
\[ \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.15158504903766e+100

    1. Initial program 14.2

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
    2. Using strategy rm
    3. Applied add-cbrt-cube 14.0

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

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

    if 2.15158504903766e+100 < x

    1. Initial program 30.1

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
    2. Using strategy rm
    3. Applied flip-- 30.1

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}}\]
    4. Applied simplify 45.7

      \[\leadsto \frac{\color{blue}{\frac{\frac{1}{\sqrt{x}}}{\sqrt{x}} - \frac{1}{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}\]
    5. Applied simplify 30.1

      \[\leadsto \frac{\color{blue}{\frac{1}{x}} - \frac{1}{x + 1}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 7.8s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1067901057 3396600083 3715501224 3126139233 3908045574 1593683916)'
(FPCore (x)
  :name "2isqrt (example 3.6)"

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

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