Average Error: 14.7 → 0.0
Time: 15.6s
Precision: 64
Internal Precision: 320
\[\sqrt{1 + x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.3352415157792068 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{\frac{1}{8}}{x}}{x \cdot x} - \left(\frac{\frac{1}{2}}{x} + x\right)\\ \mathbf{if}\;x \le 353.22601608574234:\\ \;\;\;\;\sqrt{1 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(x + \frac{\frac{1}{2}}{x}\right) - \frac{\frac{\frac{1}{8}}{x}}{x \cdot x}\\ \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 < -1.3352415157792068e+154

    1. Initial program 59.6

      \[\sqrt{1 + x \cdot x}\]
    2. Taylor expanded around -inf 0

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

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

    if -1.3352415157792068e+154 < x < 353.22601608574234

    1. Initial program 0.0

      \[\sqrt{1 + x \cdot x}\]

    if 353.22601608574234 < x

    1. Initial program 28.8

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

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

      \[\leadsto \color{blue}{\left(x + \frac{\frac{1}{2}}{x}\right) - \frac{\frac{\frac{1}{8}}{x}}{x \cdot x}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 15.6s)Debug log

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