Average Error: 29.7 → 0.1
Time: 15.0s
Precision: 64
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -19181.273392981206:\\ \;\;\;\;\frac{\frac{-16}{\left(x \cdot x\right) \cdot x} - \left(\frac{6}{x} + \frac{5}{x \cdot x}\right)}{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}\\ \mathbf{elif}\;x \le 17393.702843067982:\\ \;\;\;\;\frac{\frac{x}{1 + x} \cdot \frac{x}{1 + x} - \frac{1 + x}{x - 1} \cdot \frac{1 + x}{x - 1}}{\sqrt[3]{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}} \cdot \frac{1}{\sqrt[3]{\frac{1 + x}{x - 1} + \frac{x}{1 + x}} \cdot \sqrt[3]{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-16}{\left(x \cdot x\right) \cdot x} - \left(\frac{6}{x} + \frac{5}{x \cdot x}\right)}{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}\\ \end{array}\]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
\mathbf{if}\;x \le -19181.273392981206:\\
\;\;\;\;\frac{\frac{-16}{\left(x \cdot x\right) \cdot x} - \left(\frac{6}{x} + \frac{5}{x \cdot x}\right)}{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}\\

\mathbf{elif}\;x \le 17393.702843067982:\\
\;\;\;\;\frac{\frac{x}{1 + x} \cdot \frac{x}{1 + x} - \frac{1 + x}{x - 1} \cdot \frac{1 + x}{x - 1}}{\sqrt[3]{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}} \cdot \frac{1}{\sqrt[3]{\frac{1 + x}{x - 1} + \frac{x}{1 + x}} \cdot \sqrt[3]{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{-16}{\left(x \cdot x\right) \cdot x} - \left(\frac{6}{x} + \frac{5}{x \cdot x}\right)}{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}\\

\end{array}
double f(double x) {
        double r4622178 = x;
        double r4622179 = 1.0;
        double r4622180 = r4622178 + r4622179;
        double r4622181 = r4622178 / r4622180;
        double r4622182 = r4622178 - r4622179;
        double r4622183 = r4622180 / r4622182;
        double r4622184 = r4622181 - r4622183;
        return r4622184;
}

double f(double x) {
        double r4622185 = x;
        double r4622186 = -19181.273392981206;
        bool r4622187 = r4622185 <= r4622186;
        double r4622188 = -16.0;
        double r4622189 = r4622185 * r4622185;
        double r4622190 = r4622189 * r4622185;
        double r4622191 = r4622188 / r4622190;
        double r4622192 = 6.0;
        double r4622193 = r4622192 / r4622185;
        double r4622194 = 5.0;
        double r4622195 = r4622194 / r4622189;
        double r4622196 = r4622193 + r4622195;
        double r4622197 = r4622191 - r4622196;
        double r4622198 = 1.0;
        double r4622199 = r4622198 + r4622185;
        double r4622200 = r4622185 - r4622198;
        double r4622201 = r4622199 / r4622200;
        double r4622202 = r4622185 / r4622199;
        double r4622203 = r4622201 + r4622202;
        double r4622204 = r4622197 / r4622203;
        double r4622205 = 17393.702843067982;
        bool r4622206 = r4622185 <= r4622205;
        double r4622207 = r4622202 * r4622202;
        double r4622208 = r4622201 * r4622201;
        double r4622209 = r4622207 - r4622208;
        double r4622210 = cbrt(r4622203);
        double r4622211 = r4622209 / r4622210;
        double r4622212 = r4622210 * r4622210;
        double r4622213 = r4622198 / r4622212;
        double r4622214 = r4622211 * r4622213;
        double r4622215 = r4622206 ? r4622214 : r4622204;
        double r4622216 = r4622187 ? r4622204 : r4622215;
        return r4622216;
}

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 < -19181.273392981206 or 17393.702843067982 < x

    1. Initial program 59.2

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

      \[\leadsto \color{blue}{\frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}}\]
    4. Taylor expanded around -inf 0.3

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

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

    if -19181.273392981206 < x < 17393.702843067982

    1. Initial program 0.1

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

      \[\leadsto \color{blue}{\frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt0.1

      \[\leadsto \frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}}{\color{blue}{\left(\sqrt[3]{\frac{x}{x + 1} + \frac{x + 1}{x - 1}} \cdot \sqrt[3]{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}\right) \cdot \sqrt[3]{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}}}\]
    6. Applied *-un-lft-identity0.1

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right)}}{\left(\sqrt[3]{\frac{x}{x + 1} + \frac{x + 1}{x - 1}} \cdot \sqrt[3]{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}\right) \cdot \sqrt[3]{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}}\]
    7. Applied times-frac0.1

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{\frac{x}{x + 1} + \frac{x + 1}{x - 1}} \cdot \sqrt[3]{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}} \cdot \frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}}{\sqrt[3]{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -19181.273392981206:\\ \;\;\;\;\frac{\frac{-16}{\left(x \cdot x\right) \cdot x} - \left(\frac{6}{x} + \frac{5}{x \cdot x}\right)}{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}\\ \mathbf{elif}\;x \le 17393.702843067982:\\ \;\;\;\;\frac{\frac{x}{1 + x} \cdot \frac{x}{1 + x} - \frac{1 + x}{x - 1} \cdot \frac{1 + x}{x - 1}}{\sqrt[3]{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}} \cdot \frac{1}{\sqrt[3]{\frac{1 + x}{x - 1} + \frac{x}{1 + x}} \cdot \sqrt[3]{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-16}{\left(x \cdot x\right) \cdot x} - \left(\frac{6}{x} + \frac{5}{x \cdot x}\right)}{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019133 
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))