Average Error: 21.3 → 0.8
Time: 25.3s
Precision: 64
Internal Precision: 2368
\[\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{1 + x \cdot x}}\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.6974219668002979:\\ \;\;\;\;\left(\frac{0.00439453125}{0.25} - 0.078125\right) \cdot \frac{\frac{1}{\sqrt{0.25}}}{{x}^{5}} + \left(\frac{\frac{0.09375}{x \cdot x}}{\sqrt{0.25} \cdot x} - \frac{\sqrt{0.25}}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(\frac{x}{\left(x + \frac{\frac{1}{2}}{x}\right) - \frac{\frac{\frac{1}{8}}{x}}{x \cdot x}} + 1\right)}\\ \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 2 regimes
  2. if x < -0.6974219668002979

    1. Initial program 60.6

      \[\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{1 + x \cdot x}}\right)}\]
    2. Taylor expanded around -inf 0.1

      \[\leadsto \color{blue}{\left(0.09375 \cdot \frac{1}{\sqrt{0.25} \cdot {x}^{3}} + 0.00439453125 \cdot \frac{1}{{\left(\sqrt{0.25}\right)}^{3} \cdot {x}^{5}}\right) - \left(0.078125 \cdot \frac{1}{\sqrt{0.25} \cdot {x}^{5}} + \frac{\sqrt{0.25}}{x}\right)}\]
    3. Simplified0.1

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{0.25}}}{{x}^{5}} \cdot \left(\frac{0.00439453125}{0.25} - 0.078125\right) + \left(\frac{\frac{0.09375}{x \cdot x}}{\sqrt{0.25} \cdot x} - \frac{\sqrt{0.25}}{x}\right)}\]

    if -0.6974219668002979 < x

    1. Initial program 8.3

      \[\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{1 + x \cdot x}}\right)}\]
    2. Taylor expanded around inf 1.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.6974219668002979:\\ \;\;\;\;\left(\frac{0.00439453125}{0.25} - 0.078125\right) \cdot \frac{\frac{1}{\sqrt{0.25}}}{{x}^{5}} + \left(\frac{\frac{0.09375}{x \cdot x}}{\sqrt{0.25} \cdot x} - \frac{\sqrt{0.25}}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(\frac{x}{\left(x + \frac{\frac{1}{2}}{x}\right) - \frac{\frac{\frac{1}{8}}{x}}{x \cdot x}} + 1\right)}\\ \end{array}\]

Runtime

Time bar (total: 25.3s)Debug log

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