Average Error: 14.7 → 0.0
Time: 1.1m
Precision: 64
Internal Precision: 128
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.057615605098667 \cdot 10^{+42} \lor \neg \left(x \le 794.865895601048\right):\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{(x \cdot x + 1)_*}\\ \end{array}\]

Error

Bits error versus x

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -7.057615605098667e+42 or 794.865895601048 < x

    1. Initial program 32.3

      \[\frac{x}{x \cdot x + 1}\]
    2. Initial simplification32.3

      \[\leadsto \frac{x}{(x \cdot x + 1)_*}\]
    3. Taylor expanded around inf 0.0

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

    if -7.057615605098667e+42 < x < 794.865895601048

    1. Initial program 0.0

      \[\frac{x}{x \cdot x + 1}\]
    2. Initial simplification0.0

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

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

Runtime

Time bar (total: 1.1m)Debug logProfile

BaselineHerbieOracleSpan%
Regimes14.70.00.014.799.9%
herbie shell --seed 2018352 +o rules:numerics
(FPCore (x)
  :name "x / (x^2 + 1)"

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

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