Average Error: 29.9 → 0.1
Time: 27.8s
Precision: 64
Internal Precision: 1344
\[\sqrt{x \cdot x + x} - x\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.3602604604102958 \cdot 10^{+154}:\\ \;\;\;\;\left(\frac{\frac{1}{8}}{x} - x\right) - \left(x + \frac{1}{2}\right)\\ \mathbf{if}\;x \le 164999.76010174042:\\ \;\;\;\;\sqrt{x \cdot x + x} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} - \frac{\frac{1}{8}}{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.3602604604102958e+154

    1. Initial program 59.6

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

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

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

    if -1.3602604604102958e+154 < x < 164999.76010174042

    1. Initial program 0.1

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

    if 164999.76010174042 < x

    1. Initial program 60.3

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

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

      \[\leadsto \color{blue}{\frac{1}{2} - \frac{\frac{1}{8}}{x}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 27.8s)Debug log

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