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

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

\end{array}
double f(double x) {
        double r55219 = x;
        double r55220 = 1.0;
        double r55221 = r55219 + r55220;
        double r55222 = r55220 - r55219;
        double r55223 = r55221 / r55222;
        return r55223;
}

double f(double x) {
        double r55224 = x;
        double r55225 = -1700022.9570998326;
        bool r55226 = r55224 <= r55225;
        double r55227 = 256642.77298779495;
        bool r55228 = r55224 <= r55227;
        double r55229 = !r55228;
        bool r55230 = r55226 || r55229;
        double r55231 = 2.0;
        double r55232 = r55231 / r55224;
        double r55233 = 1.0;
        double r55234 = r55232 + r55233;
        double r55235 = r55224 * r55224;
        double r55236 = r55231 / r55235;
        double r55237 = r55234 + r55236;
        double r55238 = -r55237;
        double r55239 = 1.0;
        double r55240 = r55224 + r55239;
        double r55241 = 3.0;
        double r55242 = pow(r55239, r55241);
        double r55243 = pow(r55224, r55241);
        double r55244 = r55242 - r55243;
        double r55245 = r55240 / r55244;
        double r55246 = r55239 * r55239;
        double r55247 = r55239 * r55224;
        double r55248 = r55235 + r55247;
        double r55249 = r55246 + r55248;
        double r55250 = r55245 * r55249;
        double r55251 = r55230 ? r55238 : r55250;
        return r55251;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -1700022.9570998326 or 256642.77298779495 < x

    1. Initial program 0.0

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

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

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

      \[\leadsto \color{blue}{-\left(2 \cdot \frac{1}{{x}^{2}} + \left(2 \cdot \frac{1}{x} + 1\right)\right)}\]
    6. Simplified0.0

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

    if -1700022.9570998326 < x < 256642.77298779495

    1. Initial program 0.0

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

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

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

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

Reproduce

herbie shell --seed 2019350 
(FPCore (x)
  :name "Prelude:atanh from fay-base-0.20.0.1"
  :precision binary64
  (/ (+ x 1) (- 1 x)))