Average Error: 58.5 → 0.7
Time: 12.1s
Precision: 64
$\log \left(\frac{1 + x}{1 - x}\right)$
$2 \cdot \left(x \cdot x + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)$
\log \left(\frac{1 + x}{1 - x}\right)
2 \cdot \left(x \cdot x + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)
double f(double x) {
double r93870 = 1.0;
double r93871 = x;
double r93872 = r93870 + r93871;
double r93873 = r93870 - r93871;
double r93874 = r93872 / r93873;
double r93875 = log(r93874);
return r93875;
}


double f(double x) {
double r93876 = 2.0;
double r93877 = x;
double r93878 = r93877 * r93877;
double r93879 = r93878 + r93877;
double r93880 = r93876 * r93879;
double r93881 = 1.0;
double r93882 = log(r93881);
double r93883 = 2.0;
double r93884 = pow(r93877, r93883);
double r93885 = pow(r93881, r93883);
double r93886 = r93884 / r93885;
double r93887 = r93876 * r93886;
double r93888 = r93882 - r93887;
double r93889 = r93880 + r93888;
return r93889;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 58.5

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

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

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

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

# Reproduce

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