Average Error: 14.6 → 0.0
Time: 26.4s
Precision: 64
Internal Precision: 576
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -5.864261687274507 \cdot 10^{+52} \lor \neg \left(x \le 15389527.932909489\right):\\ \;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{(x \cdot x + 1)_*} \cdot x\\ \end{array}\]

Error

Bits error versus x

Target

Original14.6
Target0.1
Herbie0.0
\[\frac{1}{x + \frac{1}{x}}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -5.864261687274507e+52 or 15389527.932909489 < x

    1. Initial program 32.1

      \[\frac{x}{x \cdot x + 1}\]
    2. Taylor expanded around inf 0.0

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

    if -5.864261687274507e+52 < x < 15389527.932909489

    1. Initial program 0.0

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied div-inv0.0

      \[\leadsto \color{blue}{x \cdot \frac{1}{x \cdot x + 1}}\]
    4. Applied simplify0.0

      \[\leadsto x \cdot \color{blue}{\frac{1}{(x \cdot x + 1)_*}}\]
  3. Recombined 2 regimes into one program.
  4. Applied simplify0.0

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;x \le -5.864261687274507 \cdot 10^{+52} \lor \neg \left(x \le 15389527.932909489\right):\\ \;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{(x \cdot x + 1)_*} \cdot x\\ \end{array}}\]

Runtime

Time bar (total: 26.4s)Debug logProfile

herbie shell --seed '#(1072330854 3074818769 591214268 3603999196 3863745332 3332387116)' +o rules:numerics
(FPCore (x)
  :name "x / (x^2 + 1)"

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

  (/ x (+ (* x x) 1)))