Average Error: 7.9 → 0.3
Time: 2.9s
Precision: binary64
\[0.999 \leq x \land x \leq 1.001\]
\[\frac{10}{1 - x \cdot x} \]
\[\frac{10}{\mathsf{log1p}\left(\mathsf{expm1}\left(1 - x \cdot x\right)\right) + \mathsf{fma}\left(-x, x, x \cdot x\right)} \]
\frac{10}{1 - x \cdot x}
\frac{10}{\mathsf{log1p}\left(\mathsf{expm1}\left(1 - x \cdot x\right)\right) + \mathsf{fma}\left(-x, x, x \cdot x\right)}
(FPCore (x) :precision binary64 (/ 10.0 (- 1.0 (* x x))))
(FPCore (x)
 :precision binary64
 (/ 10.0 (+ (log1p (expm1 (- 1.0 (* x x)))) (fma (- x) x (* x x)))))
double code(double x) {
	return 10.0 / (1.0 - (x * x));
}
double code(double x) {
	return 10.0 / (log1p(expm1((1.0 - (x * x)))) + fma(-x, x, (x * x)));
}

Error

Bits error versus x

Derivation

  1. Initial program 7.9

    \[\frac{10}{1 - x \cdot x} \]
  2. Applied egg-rr0.3

    \[\leadsto \frac{10}{\color{blue}{\left(1 - x \cdot x\right) + \mathsf{fma}\left(-x, x, x \cdot x\right)}} \]
  3. Applied egg-rr0.4

    \[\leadsto \frac{10}{\color{blue}{\frac{{\left(1 - x \cdot x\right)}^{3}}{{\left(1 - x \cdot x\right)}^{2} + \left(0 - \left(1 - x \cdot x\right) \cdot 0\right)}} + \mathsf{fma}\left(-x, x, x \cdot x\right)} \]
  4. Applied egg-rr0.3

    \[\leadsto \frac{10}{\frac{\color{blue}{\left(1 - x \cdot x\right) \cdot {\left(1 - x \cdot x\right)}^{2}}}{{\left(1 - x \cdot x\right)}^{2} + \left(0 - \left(1 - x \cdot x\right) \cdot 0\right)} + \mathsf{fma}\left(-x, x, x \cdot x\right)} \]
  5. Applied egg-rr0.3

    \[\leadsto \frac{10}{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(1 - x \cdot x\right)\right)} + \mathsf{fma}\left(-x, x, x \cdot x\right)} \]
  6. Final simplification0.3

    \[\leadsto \frac{10}{\mathsf{log1p}\left(\mathsf{expm1}\left(1 - x \cdot x\right)\right) + \mathsf{fma}\left(-x, x, x \cdot x\right)} \]

Reproduce

herbie shell --seed 2022127 
(FPCore (x)
  :name "ENA, Section 1.4, Mentioned, B"
  :precision binary64
  :pre (and (<= 0.999 x) (<= x 1.001))
  (/ 10.0 (- 1.0 (* x x))))