Average Error: 14.7 → 0.0
Time: 12.6s
Precision: 64
Internal Precision: 320
\[\sqrt{2 + x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.3352415157792068 \cdot 10^{+154}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{1}{{x}^{3}} - \left(\frac{1}{x} + x\right)\\ \mathbf{if}\;x \le 7338.983336033995:\\ \;\;\;\;\sqrt{2 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{x} + x\right) - \frac{1}{2} \cdot \frac{1}{{x}^{3}}\\ \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{2 + x \cdot x}\]
    2. Taylor expanded around -inf 0

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

    if -1.3352415157792068e+154 < x < 7338.983336033995

    1. Initial program 0.0

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

    if 7338.983336033995 < x

    1. Initial program 28.9

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

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

Runtime

Time bar (total: 12.6s)Debug log

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