Average Error: 10.0 → 0.6
Time: 31.1s
Precision: 64
Internal Precision: 128
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x - 1 \le -175606664.94769424 \lor \neg \left(x - 1 \le -0.8901199076934925\right):\\ \;\;\;\;\frac{\frac{2}{x}}{x \cdot x} + \left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x - 1} + \left(\sqrt{\frac{1}{1 + x}} \cdot \sqrt{\frac{1}{1 + x}} - \frac{2}{x}\right)\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.0
Target0.3
Herbie0.6
\[\frac{2}{x \cdot \left(x \cdot x - 1\right)}\]

Derivation

  1. Split input into 2 regimes
  2. if (- x 1) < -175606664.94769424 or -0.8901199076934925 < (- x 1)

    1. Initial program 19.7

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

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

      \[\leadsto \color{blue}{\left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \frac{\frac{2}{x}}{x \cdot x}}\]
    4. Using strategy rm
    5. Applied associate-/r*0.3

      \[\leadsto \left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \color{blue}{\frac{\frac{\frac{2}{x}}{x}}{x}}\]
    6. Using strategy rm
    7. Applied associate-/l/0.3

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

    if -175606664.94769424 < (- x 1) < -0.8901199076934925

    1. Initial program 0.3

      \[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt0.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x - 1 \le -175606664.94769424 \lor \neg \left(x - 1 \le -0.8901199076934925\right):\\ \;\;\;\;\frac{\frac{2}{x}}{x \cdot x} + \left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x - 1} + \left(\sqrt{\frac{1}{1 + x}} \cdot \sqrt{\frac{1}{1 + x}} - \frac{2}{x}\right)\\ \end{array}\]

Runtime

Time bar (total: 31.1s)Debug logProfile

herbie shell --seed 2018277 
(FPCore (x)
  :name "3frac (problem 3.3.3)"

  :herbie-target
  (/ 2 (* x (- (* x x) 1)))

  (+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))