Average Error: 0.0 → 0.0
Time: 1.8s
Precision: binary64
Cost: 576
\[\frac{x + 1}{1 - x}\]
\[\frac{1}{\frac{1 - x}{1 + x}}\]
\frac{x + 1}{1 - x}
\frac{1}{\frac{1 - x}{1 + x}}
(FPCore (x) :precision binary64 (/ (+ x 1.0) (- 1.0 x)))
(FPCore (x) :precision binary64 (/ 1.0 (/ (- 1.0 x) (+ 1.0 x))))
double code(double x) {
	return (x + 1.0) / (1.0 - x);
}
double code(double x) {
	return 1.0 / ((1.0 - x) / (1.0 + x));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error0.0
Cost448
\[\frac{1 + x}{1 - x}\]
Alternative 2
Error0.8
Cost962
\[\begin{array}{l} \mathbf{if}\;x \leq -1.014489998475607:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 0.9960715189560951:\\ \;\;\;\;1 + x \cdot 2\\ \mathbf{else}:\\ \;\;\;\;-1 - \frac{2}{x}\\ \end{array}\]
Alternative 3
Error1.2
Cost962
\[\begin{array}{l} \mathbf{if}\;x \leq -1.014489998475607:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 0.9960715189560951:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1 - \frac{2}{x}\\ \end{array}\]
Alternative 4
Error1.3
Cost706
\[\begin{array}{l} \mathbf{if}\;x \leq -1.014489998475607:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 0.9960715189560951:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array}\]
Alternative 5
Error32.3
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.0

    \[\frac{x + 1}{1 - x}\]
  2. Using strategy rm
  3. Applied clear-num_binary64_7590.0

    \[\leadsto \color{blue}{\frac{1}{\frac{1 - x}{x + 1}}}\]
  4. Simplified0.0

    \[\leadsto \color{blue}{\frac{1}{\frac{1 - x}{x + 1}}}\]
  5. Final simplification0.0

    \[\leadsto \frac{1}{\frac{1 - x}{1 + x}}\]

Reproduce

herbie shell --seed 2021044 
(FPCore (x)
  :name "Prelude:atanh from fay-base-0.20.0.1"
  :precision binary64
  (/ (+ x 1.0) (- 1.0 x)))