Average Error: 29.6 → 0.3
Time: 11.5s
Precision: 64
Internal Precision: 1344
\[5 - \sqrt{25 + x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -5.691400533478999:\\ \;\;\;\;\frac{\frac{25}{2}}{x} + \left(x + 5\right)\\ \mathbf{elif}\;x \le 5.797773645490714:\\ \;\;\;\;{x}^{4} \cdot \frac{1}{1000} - \left(x \cdot \left(x \cdot \frac{1}{10}\right) + \frac{1}{50000} \cdot {x}^{6}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(5 - x\right) - \frac{\frac{25}{2}}{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 < -5.691400533478999

    1. Initial program 30.1

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

      \[\leadsto \color{blue}{5 + \left(x + \frac{25}{2} \cdot \frac{1}{x}\right)}\]
    3. Simplified0.3

      \[\leadsto \color{blue}{\frac{\frac{25}{2}}{x} + \left(x + 5\right)}\]

    if -5.691400533478999 < x < 5.797773645490714

    1. Initial program 29.8

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

      \[\leadsto \color{blue}{\frac{1}{1000} \cdot {x}^{4} - \left(\frac{1}{10} \cdot {x}^{2} + \frac{1}{50000} \cdot {x}^{6}\right)}\]
    3. Using strategy rm
    4. Applied unpow20.4

      \[\leadsto \frac{1}{1000} \cdot {x}^{4} - \left(\frac{1}{10} \cdot \color{blue}{\left(x \cdot x\right)} + \frac{1}{50000} \cdot {x}^{6}\right)\]
    5. Applied associate-*r*0.3

      \[\leadsto \frac{1}{1000} \cdot {x}^{4} - \left(\color{blue}{\left(\frac{1}{10} \cdot x\right) \cdot x} + \frac{1}{50000} \cdot {x}^{6}\right)\]

    if 5.797773645490714 < x

    1. Initial program 28.5

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

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

      \[\leadsto \color{blue}{\left(5 - x\right) - \frac{\frac{25}{2}}{x}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -5.691400533478999:\\ \;\;\;\;\frac{\frac{25}{2}}{x} + \left(x + 5\right)\\ \mathbf{elif}\;x \le 5.797773645490714:\\ \;\;\;\;{x}^{4} \cdot \frac{1}{1000} - \left(x \cdot \left(x \cdot \frac{1}{10}\right) + \frac{1}{50000} \cdot {x}^{6}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(5 - x\right) - \frac{\frac{25}{2}}{x}\\ \end{array}\]

Runtime

Time bar (total: 11.5s)Debug log

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