Average Error: 0.1 → 0.1
Time: 20.7s
Precision: 64
$\tanh \left(x + 1\right) - \tanh x$
$\frac{1}{\frac{\tanh 1 \cdot \tanh x + 1}{\tanh x + \tanh 1}} - \tanh x$
\tanh \left(x + 1\right) - \tanh x
\frac{1}{\frac{\tanh 1 \cdot \tanh x + 1}{\tanh x + \tanh 1}} - \tanh x
double f(double x) {
double r51908728 = x;
double r51908729 = 1.0;
double r51908730 = r51908728 + r51908729;
double r51908731 = tanh(r51908730);
double r51908732 = tanh(r51908728);
double r51908733 = r51908731 - r51908732;
return r51908733;
}


double f(double x) {
double r51908734 = 1.0;
double r51908735 = 1.0;
double r51908736 = tanh(r51908735);
double r51908737 = x;
double r51908738 = tanh(r51908737);
double r51908739 = r51908736 * r51908738;
double r51908740 = r51908739 + r51908734;
double r51908741 = r51908738 + r51908736;
double r51908742 = r51908740 / r51908741;
double r51908743 = r51908734 / r51908742;
double r51908744 = r51908743 - r51908738;
return r51908744;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.1

$\tanh \left(x + 1\right) - \tanh x$
2. Using strategy rm
3. Applied tanh-sum0.1

$\leadsto \color{blue}{\frac{\tanh x + \tanh 1}{1 + \tanh x \cdot \tanh 1}} - \tanh x$
4. Using strategy rm
5. Applied clear-num0.1

$\leadsto \color{blue}{\frac{1}{\frac{1 + \tanh x \cdot \tanh 1}{\tanh x + \tanh 1}}} - \tanh x$
6. Final simplification0.1

$\leadsto \frac{1}{\frac{\tanh 1 \cdot \tanh x + 1}{\tanh x + \tanh 1}} - \tanh x$

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "tanh(x+1)-tanh(x)"
(- (tanh (+ x 1.0)) (tanh x)))