Average Error: 0.0 → 0.0
Time: 2.2s
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 f(double x) {
        double r182942 = 1.0;
        double r182943 = x;
        double r182944 = r182943 * r182943;
        double r182945 = r182942 - r182944;
        double r182946 = sqrt(r182945);
        return r182946;
}

double f(double x) {
        double r182947 = 1.0;
        double r182948 = x;
        double r182949 = 4.0;
        double r182950 = pow(r182948, r182949);
        double r182951 = -r182950;
        double r182952 = fma(r182947, r182947, r182951);
        double r182953 = fma(r182948, r182948, r182947);
        double r182954 = r182952 / r182953;
        double r182955 = -r182948;
        double r182956 = r182948 * r182948;
        double r182957 = fma(r182955, r182948, r182956);
        double r182958 = r182954 + r182957;
        double r182959 = sqrt(r182958);
        return r182959;
}

Error

Bits error versus x

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))))