Average Error: 14.7 → 0.0
Time: 5.0s
Precision: 64
Internal Precision: 320
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.901259768893692 \cdot 10^{+55} \lor \neg \left(x \le 509.4123991212909\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 < -2.901259768893692e+55 or 509.4123991212909 < x

    1. Initial program 33.0

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

      \[\leadsto \frac{x}{(x \cdot x + 1)_*}\]
    3. Using strategy rm
    4. Applied div-inv33.0

      \[\leadsto \color{blue}{x \cdot \frac{1}{(x \cdot x + 1)_*}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt33.5

      \[\leadsto x \cdot \color{blue}{\left(\left(\sqrt[3]{\frac{1}{(x \cdot x + 1)_*}} \cdot \sqrt[3]{\frac{1}{(x \cdot x + 1)_*}}\right) \cdot \sqrt[3]{\frac{1}{(x \cdot x + 1)_*}}\right)}\]
    7. Taylor expanded around -inf 0.0

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

    if -2.901259768893692e+55 < x < 509.4123991212909

    1. Initial program 0.0

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

      \[\leadsto \frac{x}{(x \cdot x + 1)_*}\]
    3. Using strategy rm
    4. Applied div-inv0.0

      \[\leadsto \color{blue}{x \cdot \frac{1}{(x \cdot x + 1)_*}}\]
    5. Using strategy rm
    6. Applied un-div-inv0.0

      \[\leadsto \color{blue}{\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 -2.901259768893692 \cdot 10^{+55} \lor \neg \left(x \le 509.4123991212909\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: 5.0s)Debug logProfile

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

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

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