Average Error: 0.2 → 0.2
Time: 2.0s
Precision: binary64
\[\frac{1 + \tanh \left(\frac{x}{2}\right)}{1 - \tanh \left(\frac{x}{2}\right)}\]
\[\frac{1 + \tanh \left(\frac{x}{2}\right)}{1 - \tanh \left(\frac{x}{2}\right)}\]
\frac{1 + \tanh \left(\frac{x}{2}\right)}{1 - \tanh \left(\frac{x}{2}\right)}
\frac{1 + \tanh \left(\frac{x}{2}\right)}{1 - \tanh \left(\frac{x}{2}\right)}
double code(double x) {
	return ((double) (((double) (1.0 + ((double) tanh(((double) (x / 2.0)))))) / ((double) (1.0 - ((double) tanh(((double) (x / 2.0))))))));
}
double code(double x) {
	return ((double) (((double) (1.0 + ((double) tanh(((double) (x / 2.0)))))) / ((double) (1.0 - ((double) tanh(((double) (x / 2.0))))))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.2

    \[\frac{1 + \tanh \left(\frac{x}{2}\right)}{1 - \tanh \left(\frac{x}{2}\right)}\]
  2. Final simplification0.2

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

Reproduce

herbie shell --seed 2020153 
(FPCore (x)
  :name "(/ (+ 1 (tanh (/ x 2))) (- 1 (tanh (/ x 2))))"
  :precision binary64
  (/ (+ 1.0 (tanh (/ x 2.0))) (- 1.0 (tanh (/ x 2.0)))))