Average Error: 28.7 → 8.6
Time: 45.3s
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}\]
\[\begin{array}{l} \mathbf{if}\;b \le 7.238049162067772:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \left(-b\right) \cdot \left(b \cdot b\right)\right)}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right) + b \cdot b\right)}}}{a} \cdot \left(\frac{\frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right) + b \cdot b\right)}}}{\sqrt{3}} \cdot \frac{1}{\sqrt{3}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right) + b \cdot b\right)}}}{3} \cdot \frac{\left(\left(\sqrt{\frac{1}{3}} \cdot c\right) \cdot a\right) \cdot \frac{-9}{2}}{a}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le 7.238049162067772:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \left(-b\right) \cdot \left(b \cdot b\right)\right)}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right) + b \cdot b\right)}}}{a} \cdot \left(\frac{\frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right) + b \cdot b\right)}}}{\sqrt{3}} \cdot \frac{1}{\sqrt{3}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right) + b \cdot b\right)}}}{3} \cdot \frac{\left(\left(\sqrt{\frac{1}{3}} \cdot c\right) \cdot a\right) \cdot \frac{-9}{2}}{a}\\

\end{array}
double f(double a, double b, double c) {
        double r2996305 = b;
        double r2996306 = -r2996305;
        double r2996307 = r2996305 * r2996305;
        double r2996308 = 3.0;
        double r2996309 = a;
        double r2996310 = r2996308 * r2996309;
        double r2996311 = c;
        double r2996312 = r2996310 * r2996311;
        double r2996313 = r2996307 - r2996312;
        double r2996314 = sqrt(r2996313);
        double r2996315 = r2996306 + r2996314;
        double r2996316 = r2996315 / r2996310;
        return r2996316;
}

double f(double a, double b, double c) {
        double r2996317 = b;
        double r2996318 = 7.238049162067772;
        bool r2996319 = r2996317 <= r2996318;
        double r2996320 = -3.0;
        double r2996321 = c;
        double r2996322 = a;
        double r2996323 = r2996321 * r2996322;
        double r2996324 = r2996317 * r2996317;
        double r2996325 = fma(r2996320, r2996323, r2996324);
        double r2996326 = sqrt(r2996325);
        double r2996327 = -r2996317;
        double r2996328 = r2996327 * r2996324;
        double r2996329 = fma(r2996325, r2996326, r2996328);
        double r2996330 = r2996325 + r2996324;
        double r2996331 = fma(r2996317, r2996326, r2996330);
        double r2996332 = sqrt(r2996331);
        double r2996333 = r2996329 / r2996332;
        double r2996334 = r2996333 / r2996322;
        double r2996335 = 1.0;
        double r2996336 = r2996335 / r2996332;
        double r2996337 = 3.0;
        double r2996338 = sqrt(r2996337);
        double r2996339 = r2996336 / r2996338;
        double r2996340 = r2996335 / r2996338;
        double r2996341 = r2996339 * r2996340;
        double r2996342 = r2996334 * r2996341;
        double r2996343 = r2996336 / r2996337;
        double r2996344 = 0.3333333333333333;
        double r2996345 = sqrt(r2996344);
        double r2996346 = r2996345 * r2996321;
        double r2996347 = r2996346 * r2996322;
        double r2996348 = -4.5;
        double r2996349 = r2996347 * r2996348;
        double r2996350 = r2996349 / r2996322;
        double r2996351 = r2996343 * r2996350;
        double r2996352 = r2996319 ? r2996342 : r2996351;
        return r2996352;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 2 regimes
  2. if b < 7.238049162067772

    1. Initial program 13.2

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

      \[\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--13.4

      \[\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. Simplified12.7

      \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)} - \left(b \cdot b\right) \cdot b}}{\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. Simplified12.7

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

      \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}{3 \cdot a}\]
    9. Using strategy rm
    10. Applied add-sqr-sqrt12.6

      \[\leadsto \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}{\color{blue}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}}{3 \cdot a}\]
    11. Applied *-un-lft-identity12.6

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot \mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{3 \cdot a}\]
    12. Applied times-frac12.6

      \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}} \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}}{3 \cdot a}\]
    13. Applied times-frac12.6

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{3} \cdot \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{a}}\]
    14. Using strategy rm
    15. Applied add-sqr-sqrt12.6

      \[\leadsto \frac{\frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{\color{blue}{\sqrt{3} \cdot \sqrt{3}}} \cdot \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{a}\]
    16. Applied div-inv12.6

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}}{\sqrt{3} \cdot \sqrt{3}} \cdot \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{a}\]
    17. Applied times-frac12.6

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

    if 7.238049162067772 < b

    1. Initial program 32.9

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

      \[\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--33.0

      \[\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. Simplified32.3

      \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)} - \left(b \cdot b\right) \cdot b}}{\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. Simplified32.3

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

      \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}{3 \cdot a}\]
    9. Using strategy rm
    10. Applied add-sqr-sqrt31.6

      \[\leadsto \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}{\color{blue}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}}{3 \cdot a}\]
    11. Applied *-un-lft-identity31.6

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot \mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{3 \cdot a}\]
    12. Applied times-frac31.6

      \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}} \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}}{3 \cdot a}\]
    13. Applied times-frac31.6

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{3} \cdot \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{a}}\]
    14. Taylor expanded around 0 7.5

      \[\leadsto \frac{\frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{3} \cdot \frac{\color{blue}{\frac{-9}{2} \cdot \left(a \cdot \left(\sqrt{\frac{1}{3}} \cdot c\right)\right)}}{a}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 7.238049162067772:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \left(-b\right) \cdot \left(b \cdot b\right)\right)}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right) + b \cdot b\right)}}}{a} \cdot \left(\frac{\frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right) + b \cdot b\right)}}}{\sqrt{3}} \cdot \frac{1}{\sqrt{3}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right) + b \cdot b\right)}}}{3} \cdot \frac{\left(\left(\sqrt{\frac{1}{3}} \cdot c\right) \cdot a\right) \cdot \frac{-9}{2}}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019149 +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)))