Average Error: 58.4 → 0.7
Time: 6.8s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{1}{2} \cdot \left(2 \cdot \left({x}^{2} + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)\]
\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)
\frac{1}{2} \cdot \left(2 \cdot \left({x}^{2} + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)
double f(double x) {
        double r96829 = 1.0;
        double r96830 = 2.0;
        double r96831 = r96829 / r96830;
        double r96832 = x;
        double r96833 = r96829 + r96832;
        double r96834 = r96829 - r96832;
        double r96835 = r96833 / r96834;
        double r96836 = log(r96835);
        double r96837 = r96831 * r96836;
        return r96837;
}

double f(double x) {
        double r96838 = 1.0;
        double r96839 = 2.0;
        double r96840 = r96838 / r96839;
        double r96841 = x;
        double r96842 = 2.0;
        double r96843 = pow(r96841, r96842);
        double r96844 = r96843 + r96841;
        double r96845 = r96839 * r96844;
        double r96846 = log(r96838);
        double r96847 = pow(r96838, r96842);
        double r96848 = r96843 / r96847;
        double r96849 = r96839 * r96848;
        double r96850 = r96846 - r96849;
        double r96851 = r96845 + r96850;
        double r96852 = r96840 * r96851;
        return r96852;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.4

    \[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
  2. Taylor expanded around 0 0.7

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

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(2 \cdot \left({x}^{2} + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)}\]
  4. Final simplification0.7

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

Reproduce

herbie shell --seed 2020057 
(FPCore (x)
  :name "Hyperbolic arc-(co)tangent"
  :precision binary64
  (* (/ 1 2) (log (/ (+ 1 x) (- 1 x)))))