Average Error: 39.1 → 0.1
Time: 7.1s
Precision: 64
Internal Precision: 1344
\[\sqrt{x + 4} - 2\]
\[\begin{array}{l} \mathbf{if}\;x \le 0.0007696105650111537:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(\frac{1}{512} \cdot x - \frac{1}{64}\right) + \frac{1}{4} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 4} - 2\\ \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.0007696105650111537

    1. Initial program 58.9

      \[\sqrt{x + 4} - 2\]
    2. Taylor expanded around 0 0.2

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

      \[\leadsto \color{blue}{\frac{1}{4} \cdot x + \left(\frac{1}{512} \cdot x - \frac{1}{64}\right) \cdot \left(x \cdot x\right)}\]

    if 0.0007696105650111537 < x

    1. Initial program 0.1

      \[\sqrt{x + 4} - 2\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 0.0007696105650111537:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(\frac{1}{512} \cdot x - \frac{1}{64}\right) + \frac{1}{4} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 4} - 2\\ \end{array}\]

Runtime

Time bar (total: 7.1s)Debug log

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