Average Error: 7.8 → 0.2
Time: 4.6s
Precision: binary64
Cost: 6720
\[0.999 \leq x \land x \leq 1.001\]
\[\frac{10}{1 - x \cdot x} \]
\[\frac{-10}{\mathsf{fma}\left(x, x, -1\right)} \]
(FPCore (x) :precision binary64 (/ 10.0 (- 1.0 (* x x))))
(FPCore (x) :precision binary64 (/ -10.0 (fma x x -1.0)))
double code(double x) {
	return 10.0 / (1.0 - (x * x));
}
double code(double x) {
	return -10.0 / fma(x, x, -1.0);
}
function code(x)
	return Float64(10.0 / Float64(1.0 - Float64(x * x)))
end
function code(x)
	return Float64(-10.0 / fma(x, x, -1.0))
end
code[x_] := N[(10.0 / N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(-10.0 / N[(x * x + -1.0), $MachinePrecision]), $MachinePrecision]
\frac{10}{1 - x \cdot x}
\frac{-10}{\mathsf{fma}\left(x, x, -1\right)}

Error

Derivation

  1. Initial program 7.8

    \[\frac{10}{1 - x \cdot x} \]
  2. Simplified0.2

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

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

Alternatives

Alternative 1
Error7.9
Cost1088
\[\frac{10}{\frac{1 - \left(x \cdot x\right) \cdot \left(x \cdot x\right)}{1 + x \cdot x}} \]
Alternative 2
Error55.4
Cost580
\[\begin{array}{l} \mathbf{if}\;x \cdot x \leq 1:\\ \;\;\;\;\frac{10}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;-10\\ \end{array} \]
Alternative 3
Error7.8
Cost576
\[10 \cdot \frac{1}{1 - x \cdot x} \]
Alternative 4
Error7.8
Cost448
\[\frac{10}{1 - x \cdot x} \]
Alternative 5
Error55.4
Cost196
\[\begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;10\\ \mathbf{else}:\\ \;\;\;\;-10\\ \end{array} \]
Alternative 6
Error60.5
Cost64
\[-10 \]

Error

Reproduce

herbie shell --seed 2022228 
(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))))