Average Error: 15.0 → 0.0
Time: 18.9s
Precision: 64
Internal precision: 128
\[\frac{x}{{x}^2 + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -162969717.01587787:\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\\ \mathbf{if}\;x \le 38849.916482614:\\ \;\;\;\;\frac{x}{{\left({x}^2\right)}^2 - {1}^2} \cdot \left({x}^2 - 1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\\ \end{array}\]

Error

Bits error versus x

Target

Original15.0
Comparison0.1
Herbie0.0
\[ \frac{1}{x + \frac{1}{x}} \]

Derivation

  1. Split input into 2 regimes.
  2. if x < -162969717.01587787 or 38849.916482614 < x

    1. Initial program 30.5

      \[\frac{x}{{x}^2 + 1}\]
    2. Applied taylor 0.0

      \[\leadsto \left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\]
    3. Taylor expanded around inf 0.0

      \[\leadsto \color{blue}{\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}}\]

    if -162969717.01587787 < x < 38849.916482614

    1. Initial program 0.0

      \[\frac{x}{{x}^2 + 1}\]
    2. Using strategy rm
    3. Applied flip-+ 0.0

      \[\leadsto \frac{x}{\color{blue}{\frac{{\left({x}^2\right)}^2 - {1}^2}{{x}^2 - 1}}}\]
    4. Applied associate-/r/ 0.0

      \[\leadsto \color{blue}{\frac{x}{{\left({x}^2\right)}^2 - {1}^2} \cdot \left({x}^2 - 1\right)}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 18.9s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(1395211471 3142137489 386578953 58333272 1700701722 3453428969)'
(FPCore (x)
  :name "x / (x^2 + 1)"

  :target
  (/ 1 (+ x (/ 1 x)))

  (/ x (+ (sqr x) 1)))