Average Error: 22.9 → 0.0
Time: 25.8s
Precision: 64
Internal Precision: 2368
\[\sqrt{{x}^{2} + 1} - x\]
\[\begin{array}{l} \mathbf{if}\;x \le -63.65339348579835:\\ \;\;\;\;\left(\frac{\frac{\frac{1}{8}}{x}}{x \cdot x} - \left(x + \frac{\frac{1}{2}}{x}\right)\right) - x\\ \mathbf{elif}\;x \le 7338.983336033995:\\ \;\;\;\;\frac{1}{\sqrt[3]{\left(\left(x + \sqrt{x \cdot x + 1}\right) \cdot \left(x + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(x + \sqrt{x \cdot x + 1}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{1}{2}}{x} - \frac{\frac{\frac{1}{8}}{x}}{x \cdot x}\right) + \frac{\frac{1}{16}}{{x}^{5}}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if x < -63.65339348579835

    1. Initial program 30.1

      \[\sqrt{{x}^{2} + 1} - x\]
    2. Initial simplification30.1

      \[\leadsto \sqrt{1 + x \cdot x} - x\]
    3. Taylor expanded around -inf 0.0

      \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot \frac{1}{{x}^{3}} - \left(x + \frac{1}{2} \cdot \frac{1}{x}\right)\right)} - x\]
    4. Simplified0.0

      \[\leadsto \color{blue}{\left(\frac{\frac{\frac{1}{8}}{x}}{x \cdot x} - \left(\frac{\frac{1}{2}}{x} + x\right)\right)} - x\]

    if -63.65339348579835 < x < 7338.983336033995

    1. Initial program 0.1

      \[\sqrt{{x}^{2} + 1} - x\]
    2. Initial simplification0.1

      \[\leadsto \sqrt{1 + x \cdot x} - x\]
    3. Using strategy rm
    4. Applied add-cbrt-cube0.1

      \[\leadsto \color{blue}{\sqrt[3]{\left(\left(\sqrt{1 + x \cdot x} - x\right) \cdot \left(\sqrt{1 + x \cdot x} - x\right)\right) \cdot \left(\sqrt{1 + x \cdot x} - x\right)}}\]
    5. Using strategy rm
    6. Applied flip--0.1

      \[\leadsto \sqrt[3]{\left(\left(\sqrt{1 + x \cdot x} - x\right) \cdot \left(\sqrt{1 + x \cdot x} - x\right)\right) \cdot \color{blue}{\frac{\sqrt{1 + x \cdot x} \cdot \sqrt{1 + x \cdot x} - x \cdot x}{\sqrt{1 + x \cdot x} + x}}}\]
    7. Applied flip--0.1

      \[\leadsto \sqrt[3]{\left(\left(\sqrt{1 + x \cdot x} - x\right) \cdot \color{blue}{\frac{\sqrt{1 + x \cdot x} \cdot \sqrt{1 + x \cdot x} - x \cdot x}{\sqrt{1 + x \cdot x} + x}}\right) \cdot \frac{\sqrt{1 + x \cdot x} \cdot \sqrt{1 + x \cdot x} - x \cdot x}{\sqrt{1 + x \cdot x} + x}}\]
    8. Applied flip--0.1

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

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{\left(\left(\sqrt{1 + x \cdot x} \cdot \sqrt{1 + x \cdot x} - x \cdot x\right) \cdot \left(\sqrt{1 + x \cdot x} \cdot \sqrt{1 + x \cdot x} - x \cdot x\right)\right) \cdot \left(\sqrt{1 + x \cdot x} \cdot \sqrt{1 + x \cdot x} - x \cdot x\right)}{\left(\left(\sqrt{1 + x \cdot x} + x\right) \cdot \left(\sqrt{1 + x \cdot x} + x\right)\right) \cdot \left(\sqrt{1 + x \cdot x} + x\right)}}}\]
    11. Applied cbrt-div0.1

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\left(\left(\sqrt{1 + x \cdot x} \cdot \sqrt{1 + x \cdot x} - x \cdot x\right) \cdot \left(\sqrt{1 + x \cdot x} \cdot \sqrt{1 + x \cdot x} - x \cdot x\right)\right) \cdot \left(\sqrt{1 + x \cdot x} \cdot \sqrt{1 + x \cdot x} - x \cdot x\right)}}{\sqrt[3]{\left(\left(\sqrt{1 + x \cdot x} + x\right) \cdot \left(\sqrt{1 + x \cdot x} + x\right)\right) \cdot \left(\sqrt{1 + x \cdot x} + x\right)}}}\]
    12. Simplified0.0

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

    if 7338.983336033995 < x

    1. Initial program 61.9

      \[\sqrt{{x}^{2} + 1} - x\]
    2. Initial simplification61.9

      \[\leadsto \sqrt{1 + x \cdot x} - x\]
    3. Taylor expanded around inf 0.0

      \[\leadsto \color{blue}{\left(\frac{1}{16} \cdot \frac{1}{{x}^{5}} + \frac{1}{2} \cdot \frac{1}{x}\right) - \frac{1}{8} \cdot \frac{1}{{x}^{3}}}\]
    4. Simplified0.0

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

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

Runtime

Time bar (total: 25.8s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (x)
  :name "sqrt(x^2+1)-x"
  (- (sqrt (+ (pow x 2) 1)) x))