Average Error: 0.0 → 0.0
Time: 1.1min
Precision: binary64
Cost: 448
\[\frac{x + 1}{1 - x}\]
\[\frac{-1 - x}{-1 + x}\]
\frac{x + 1}{1 - x}
\frac{-1 - x}{-1 + x}
(FPCore (x) :precision binary64 (/ (+ x 1.0) (- 1.0 x)))
(FPCore (x) :precision binary64 (/ (- -1.0 x) (+ -1.0 x)))
double code(double x) {
	return (x + 1.0) / (1.0 - x);
}
double code(double x) {
	return (-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.6
Cost648
\[\begin{array}{l} \mathbf{if}\;x \leq -2.05359069684278 \lor \neg \left(x \leq 0.9945285781400639\right):\\ \;\;\;\;-1 - \frac{2}{x}\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot 2\\ \end{array}\]
Alternative 2
Error0.9
Cost648
\[\begin{array}{l} \mathbf{if}\;x \leq -2.2384559699793503 \lor \neg \left(x \leq 0.9945285781400639\right):\\ \;\;\;\;-1 - \frac{2}{x}\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array}\]
Alternative 3
Error1.3
Cost834
\[\begin{array}{l} \mathbf{if}\;x \leq -1.9805790301372477:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 0.9945285781400639:\\ \;\;\;\;x + 1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array}\]
Alternative 4
Error1.3
Cost706
\[\begin{array}{l} \mathbf{if}\;x \leq -1.0100363461702562:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 0.9945285781400639:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array}\]
Alternative 5
Error32.1
Cost64
\[-1\]

Error

Time

Derivation

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{{\left(\frac{x + 1}{1 - x}\right)}^{1}}\]
  4. Using strategy rm
  5. Applied frac-2neg_binary64_890.0

    \[\leadsto {\color{blue}{\left(\frac{-\left(x + 1\right)}{-\left(1 - x\right)}\right)}}^{1}\]
  6. Simplified0.0

    \[\leadsto {\left(\frac{\color{blue}{-1 - x}}{-\left(1 - x\right)}\right)}^{1}\]
  7. Simplified0.0

    \[\leadsto {\left(\frac{-1 - x}{\color{blue}{x - 1}}\right)}^{1}\]
  8. Simplified0.0

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

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

Reproduce

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