Average Error: 15.2 → 0.0
Time: 2.9s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -5302.57371417422382364748045802116394043 \lor \neg \left(x \le 442.9064156803048035726533271372318267822\right):\\ \;\;\;\;\left(1 \cdot \frac{1}{{x}^{5}} + \frac{1}{x}\right) - 1 \cdot \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{{\left(x \cdot x\right)}^{3} + {1}^{3}} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(1 \cdot 1 - \left(x \cdot x\right) \cdot 1\right)\right)\\ \end{array}\]
\frac{x}{x \cdot x + 1}
\begin{array}{l}
\mathbf{if}\;x \le -5302.57371417422382364748045802116394043 \lor \neg \left(x \le 442.9064156803048035726533271372318267822\right):\\
\;\;\;\;\left(1 \cdot \frac{1}{{x}^{5}} + \frac{1}{x}\right) - 1 \cdot \frac{1}{{x}^{3}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{{\left(x \cdot x\right)}^{3} + {1}^{3}} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(1 \cdot 1 - \left(x \cdot x\right) \cdot 1\right)\right)\\

\end{array}
double f(double x) {
        double r80135 = x;
        double r80136 = r80135 * r80135;
        double r80137 = 1.0;
        double r80138 = r80136 + r80137;
        double r80139 = r80135 / r80138;
        return r80139;
}

double f(double x) {
        double r80140 = x;
        double r80141 = -5302.573714174224;
        bool r80142 = r80140 <= r80141;
        double r80143 = 442.9064156803048;
        bool r80144 = r80140 <= r80143;
        double r80145 = !r80144;
        bool r80146 = r80142 || r80145;
        double r80147 = 1.0;
        double r80148 = 1.0;
        double r80149 = 5.0;
        double r80150 = pow(r80140, r80149);
        double r80151 = r80148 / r80150;
        double r80152 = r80147 * r80151;
        double r80153 = r80148 / r80140;
        double r80154 = r80152 + r80153;
        double r80155 = 3.0;
        double r80156 = pow(r80140, r80155);
        double r80157 = r80148 / r80156;
        double r80158 = r80147 * r80157;
        double r80159 = r80154 - r80158;
        double r80160 = r80140 * r80140;
        double r80161 = pow(r80160, r80155);
        double r80162 = pow(r80147, r80155);
        double r80163 = r80161 + r80162;
        double r80164 = r80140 / r80163;
        double r80165 = r80160 * r80160;
        double r80166 = r80147 * r80147;
        double r80167 = r80160 * r80147;
        double r80168 = r80166 - r80167;
        double r80169 = r80165 + r80168;
        double r80170 = r80164 * r80169;
        double r80171 = r80146 ? r80159 : r80170;
        return r80171;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -5302.573714174224 or 442.9064156803048 < x

    1. Initial program 30.8

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied flip3-+53.3

      \[\leadsto \frac{x}{\color{blue}{\frac{{\left(x \cdot x\right)}^{3} + {1}^{3}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(1 \cdot 1 - \left(x \cdot x\right) \cdot 1\right)}}}\]
    4. Applied associate-/r/53.3

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

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

    if -5302.573714174224 < x < 442.9064156803048

    1. Initial program 0.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -5302.57371417422382364748045802116394043 \lor \neg \left(x \le 442.9064156803048035726533271372318267822\right):\\ \;\;\;\;\left(1 \cdot \frac{1}{{x}^{5}} + \frac{1}{x}\right) - 1 \cdot \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{{\left(x \cdot x\right)}^{3} + {1}^{3}} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(1 \cdot 1 - \left(x \cdot x\right) \cdot 1\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019318 
(FPCore (x)
  :name "x / (x^2 + 1)"
  :precision binary64

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

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