Average Error: 58.6 → 0.6
Time: 12.8s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{1}{2} \cdot \left(2 \cdot \left(x \cdot x + 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 \cdot x + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)
double f(double x) {
        double r95948 = 1.0;
        double r95949 = 2.0;
        double r95950 = r95948 / r95949;
        double r95951 = x;
        double r95952 = r95948 + r95951;
        double r95953 = r95948 - r95951;
        double r95954 = r95952 / r95953;
        double r95955 = log(r95954);
        double r95956 = r95950 * r95955;
        return r95956;
}

double f(double x) {
        double r95957 = 1.0;
        double r95958 = 2.0;
        double r95959 = r95957 / r95958;
        double r95960 = x;
        double r95961 = r95960 * r95960;
        double r95962 = r95961 + r95960;
        double r95963 = r95958 * r95962;
        double r95964 = log(r95957);
        double r95965 = 2.0;
        double r95966 = pow(r95960, r95965);
        double r95967 = pow(r95957, r95965);
        double r95968 = r95966 / r95967;
        double r95969 = r95958 * r95968;
        double r95970 = r95964 - r95969;
        double r95971 = r95963 + r95970;
        double r95972 = r95959 * r95971;
        return r95972;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.6

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

    \[\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.6

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

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

Reproduce

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