Average Error: 28.5 → 25.0
Time: 34.1s
Precision: 64
\[1.0536712127723509 \cdot 10^{-08} \lt a \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt b \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt c \lt 94906265.62425156\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\frac{\frac{\left(b \cdot b\right) \cdot \frac{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)} - b \cdot \left(b \cdot b\right)}{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right) + \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)}, b \cdot b\right)} + \sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, b \cdot b + \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)\right)}}{a \cdot 3}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{\frac{\left(b \cdot b\right) \cdot \frac{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)} - b \cdot \left(b \cdot b\right)}{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right) + \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)}, b \cdot b\right)} + \sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, b \cdot b + \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)\right)}}{a \cdot 3}
double f(double a, double b, double c) {
        double r4431310 = b;
        double r4431311 = -r4431310;
        double r4431312 = r4431310 * r4431310;
        double r4431313 = 3.0;
        double r4431314 = a;
        double r4431315 = r4431313 * r4431314;
        double r4431316 = c;
        double r4431317 = r4431315 * r4431316;
        double r4431318 = r4431312 - r4431317;
        double r4431319 = sqrt(r4431318);
        double r4431320 = r4431311 + r4431319;
        double r4431321 = r4431320 / r4431315;
        return r4431321;
}

double f(double a, double b, double c) {
        double r4431322 = b;
        double r4431323 = r4431322 * r4431322;
        double r4431324 = c;
        double r4431325 = -3.0;
        double r4431326 = a;
        double r4431327 = r4431325 * r4431326;
        double r4431328 = fma(r4431324, r4431327, r4431323);
        double r4431329 = sqrt(r4431328);
        double r4431330 = r4431328 * r4431329;
        double r4431331 = r4431322 * r4431323;
        double r4431332 = r4431330 - r4431331;
        double r4431333 = fma(r4431322, r4431329, r4431323);
        double r4431334 = r4431328 + r4431333;
        double r4431335 = r4431332 / r4431334;
        double r4431336 = r4431323 * r4431335;
        double r4431337 = r4431326 * r4431324;
        double r4431338 = fma(r4431337, r4431325, r4431323);
        double r4431339 = sqrt(r4431338);
        double r4431340 = r4431337 * r4431325;
        double r4431341 = r4431339 * r4431340;
        double r4431342 = r4431336 + r4431341;
        double r4431343 = r4431323 + r4431338;
        double r4431344 = fma(r4431339, r4431322, r4431343);
        double r4431345 = r4431342 / r4431344;
        double r4431346 = 3.0;
        double r4431347 = r4431326 * r4431346;
        double r4431348 = r4431345 / r4431347;
        return r4431348;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 28.5

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
  2. Simplified28.5

    \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} - b}{3 \cdot a}}\]
  3. Using strategy rm
  4. Applied flip3--28.6

    \[\leadsto \frac{\color{blue}{\frac{{\left(\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}\right)}^{3} - {b}^{3}}{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} + \left(b \cdot b + \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} \cdot b\right)}}}{3 \cdot a}\]
  5. Simplified27.9

    \[\leadsto \frac{\frac{\color{blue}{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) - b \cdot \left(b \cdot b\right)}}{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} + \left(b \cdot b + \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} \cdot b\right)}}{3 \cdot a}\]
  6. Simplified27.9

    \[\leadsto \frac{\frac{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) - b \cdot \left(b \cdot b\right)}{\color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) + b \cdot b\right)}}}{3 \cdot a}\]
  7. Using strategy rm
  8. Applied fma-udef27.9

    \[\leadsto \frac{\frac{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \color{blue}{\left(\left(a \cdot c\right) \cdot -3 + b \cdot b\right)} - b \cdot \left(b \cdot b\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) + b \cdot b\right)}}{3 \cdot a}\]
  9. Applied distribute-lft-in27.8

    \[\leadsto \frac{\frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right) + \sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(b \cdot b\right)\right)} - b \cdot \left(b \cdot b\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) + b \cdot b\right)}}{3 \cdot a}\]
  10. Applied associate--l+26.0

    \[\leadsto \frac{\frac{\color{blue}{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right) + \left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(b \cdot b\right) - b \cdot \left(b \cdot b\right)\right)}}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) + b \cdot b\right)}}{3 \cdot a}\]
  11. Using strategy rm
  12. Applied distribute-rgt-out--25.5

    \[\leadsto \frac{\frac{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right) + \color{blue}{\left(b \cdot b\right) \cdot \left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} - b\right)}}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) + b \cdot b\right)}}{3 \cdot a}\]
  13. Using strategy rm
  14. Applied flip3--25.6

    \[\leadsto \frac{\frac{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right) + \left(b \cdot b\right) \cdot \color{blue}{\frac{{\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}\right)}^{3} - {b}^{3}}{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} + \left(b \cdot b + \sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot b\right)}}}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) + b \cdot b\right)}}{3 \cdot a}\]
  15. Simplified25.0

    \[\leadsto \frac{\frac{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right) + \left(b \cdot b\right) \cdot \frac{\color{blue}{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)} - b \cdot \left(b \cdot b\right)}}{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} + \left(b \cdot b + \sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot b\right)}}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) + b \cdot b\right)}}{3 \cdot a}\]
  16. Simplified25.0

    \[\leadsto \frac{\frac{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right) + \left(b \cdot b\right) \cdot \frac{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)} - b \cdot \left(b \cdot b\right)}{\color{blue}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)}, b \cdot b\right) + \mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)}}}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) + b \cdot b\right)}}{3 \cdot a}\]
  17. Final simplification25.0

    \[\leadsto \frac{\frac{\left(b \cdot b\right) \cdot \frac{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)} - b \cdot \left(b \cdot b\right)}{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right) + \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)}, b \cdot b\right)} + \sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, b \cdot b + \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)\right)}}{a \cdot 3}\]

Reproduce

herbie shell --seed 2019162 +o rules:numerics
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))