Average Error: 7.8 → 0.3
Time: 7.9s
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.3

    \[\leadsto \color{blue}{\frac{-10}{\mathsf{fma}\left(x, x, -1\right)}} \]
    Proof
    (/.f64 -10 (fma.f64 x x -1)): 0 points increase in error, 0 points decrease in error
    (/.f64 (Rewrite<= metadata-eval (/.f64 10 -1)) (fma.f64 x x -1)): 0 points increase in error, 0 points decrease in error
    (/.f64 (/.f64 10 -1) (fma.f64 x x (Rewrite<= metadata-eval (neg.f64 1)))): 0 points increase in error, 0 points decrease in error
    (/.f64 (/.f64 10 -1) (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x x) 1))): 256 points increase in error, 0 points decrease in error
    (Rewrite<= associate-/r*_binary64 (/.f64 10 (*.f64 -1 (-.f64 (*.f64 x x) 1)))): 0 points increase in error, 0 points decrease in error
    (/.f64 10 (Rewrite<= neg-mul-1_binary64 (neg.f64 (-.f64 (*.f64 x x) 1)))): 0 points increase in error, 0 points decrease in error
    (/.f64 10 (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 (*.f64 x x) 1)))): 0 points increase in error, 0 points decrease in error
    (/.f64 10 (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 (*.f64 x x)) 1))): 0 points increase in error, 0 points decrease in error
    (/.f64 10 (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 (*.f64 x x))) 1)): 0 points increase in error, 0 points decrease in error
    (/.f64 10 (+.f64 (Rewrite<= distribute-lft-neg-out_binary64 (*.f64 (neg.f64 x) x)) 1)): 0 points increase in error, 0 points decrease in error
    (/.f64 10 (Rewrite<= +-commutative_binary64 (+.f64 1 (*.f64 (neg.f64 x) x)))): 0 points increase in error, 0 points decrease in error
    (/.f64 10 (Rewrite<= cancel-sign-sub-inv_binary64 (-.f64 1 (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
  3. Final simplification0.3

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

Alternatives

Alternative 1
Error55.4
Cost580
\[\begin{array}{l} \mathbf{if}\;x \cdot x \leq 1:\\ \;\;\;\;10\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-10}{x}}{x}\\ \end{array} \]
Alternative 2
Error7.8
Cost448
\[\frac{10}{1 - x \cdot x} \]
Alternative 3
Error57.9
Cost64
\[10 \]

Error

Reproduce

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