Average Error: 0.0 → 0.0
Time: 3.4s
Precision: 64
\[\sqrt{1 - x \cdot x}\]
\[e^{\log \left(\sqrt{\mathsf{fma}\left(-x, x, 1\right)}\right)}\]
\sqrt{1 - x \cdot x}
e^{\log \left(\sqrt{\mathsf{fma}\left(-x, x, 1\right)}\right)}
double f(double x) {
        double r112722 = 1.0;
        double r112723 = x;
        double r112724 = r112723 * r112723;
        double r112725 = r112722 - r112724;
        double r112726 = sqrt(r112725);
        return r112726;
}

double f(double x) {
        double r112727 = x;
        double r112728 = -r112727;
        double r112729 = 1.0;
        double r112730 = fma(r112728, r112727, r112729);
        double r112731 = sqrt(r112730);
        double r112732 = log(r112731);
        double r112733 = exp(r112732);
        return r112733;
}

Error

Bits error versus x

Derivation

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{e^{\log \left(\sqrt{1 - x \cdot x}\right)}}\]
  4. Simplified0.0

    \[\leadsto e^{\color{blue}{\log \left(\sqrt{\mathsf{fma}\left(-x, x, 1\right)}\right)}}\]
  5. Final simplification0.0

    \[\leadsto e^{\log \left(\sqrt{\mathsf{fma}\left(-x, x, 1\right)}\right)}\]

Reproduce

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