Average Error: 0.0 → 0.0
Time: 2.3s
Precision: 64
\[\sqrt{1 - x \cdot x}\]
\[\sqrt{\frac{\mathsf{fma}\left(1, 1, -{x}^{4}\right)}{\mathsf{fma}\left(x, x, 1\right)} + \mathsf{fma}\left(-x, x, x \cdot x\right)}\]
\sqrt{1 - x \cdot x}
\sqrt{\frac{\mathsf{fma}\left(1, 1, -{x}^{4}\right)}{\mathsf{fma}\left(x, x, 1\right)} + \mathsf{fma}\left(-x, x, x \cdot x\right)}
double code(double x) {
	return sqrt((1.0 - (x * x)));
}
double code(double x) {
	return sqrt(((fma(1.0, 1.0, -pow(x, 4.0)) / fma(x, x, 1.0)) + fma(-x, x, (x * x))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\sqrt{1 - x \cdot x}\]
  2. Using strategy rm
  3. Applied add-cube-cbrt0.0

    \[\leadsto \sqrt{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}} - x \cdot x}\]
  4. Applied prod-diff0.0

    \[\leadsto \sqrt{\color{blue}{\mathsf{fma}\left(\sqrt[3]{1} \cdot \sqrt[3]{1}, \sqrt[3]{1}, -x \cdot x\right) + \mathsf{fma}\left(-x, x, x \cdot x\right)}}\]
  5. Simplified0.0

    \[\leadsto \sqrt{\color{blue}{\left(1 - {x}^{2}\right)} + \mathsf{fma}\left(-x, x, x \cdot x\right)}\]
  6. Using strategy rm
  7. Applied flip--0.0

    \[\leadsto \sqrt{\color{blue}{\frac{1 \cdot 1 - {x}^{2} \cdot {x}^{2}}{1 + {x}^{2}}} + \mathsf{fma}\left(-x, x, x \cdot x\right)}\]
  8. Simplified0.0

    \[\leadsto \sqrt{\frac{\color{blue}{\mathsf{fma}\left(1, 1, -{x}^{4}\right)}}{1 + {x}^{2}} + \mathsf{fma}\left(-x, x, x \cdot x\right)}\]
  9. Simplified0.0

    \[\leadsto \sqrt{\frac{\mathsf{fma}\left(1, 1, -{x}^{4}\right)}{\color{blue}{\mathsf{fma}\left(x, x, 1\right)}} + \mathsf{fma}\left(-x, x, x \cdot x\right)}\]
  10. Final simplification0.0

    \[\leadsto \sqrt{\frac{\mathsf{fma}\left(1, 1, -{x}^{4}\right)}{\mathsf{fma}\left(x, x, 1\right)} + \mathsf{fma}\left(-x, x, x \cdot x\right)}\]

Reproduce

herbie shell --seed 2020057 +o rules:numerics
(FPCore (x)
  :name "Diagrams.TwoD.Ellipse:ellipse from diagrams-lib-1.3.0.3"
  :precision binary64
  (sqrt (- 1 (* x x))))