Average Error: 33.7 → 13.1
Time: 4.8s
Precision: 64
\[\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 -2.2724541866372811 \cdot 10^{165}:\\ \;\;\;\;\frac{\left(-b\right) + \left(\frac{\frac{1}{2} \cdot \left(\left(a \cdot 3\right) \cdot c\right)}{b} + \left(-b\right)\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le 1.72707344940377835 \cdot 10^{-162}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - {\left(3 \cdot \left(a \cdot c\right)\right)}^{1}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 5.80649981292105005 \cdot 10^{110}:\\ \;\;\;\;\frac{\frac{0 + 3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{-1}{2} \cdot \left(\left(a \cdot 3\right) \cdot c\right)}{b}}{3 \cdot 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 -2.2724541866372811 \cdot 10^{165}:\\
\;\;\;\;\frac{\left(-b\right) + \left(\frac{\frac{1}{2} \cdot \left(\left(a \cdot 3\right) \cdot c\right)}{b} + \left(-b\right)\right)}{3 \cdot a}\\

\mathbf{elif}\;b \le 1.72707344940377835 \cdot 10^{-162}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - {\left(3 \cdot \left(a \cdot c\right)\right)}^{1}}}{3 \cdot a}\\

\mathbf{elif}\;b \le 5.80649981292105005 \cdot 10^{110}:\\
\;\;\;\;\frac{\frac{0 + 3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{-1}{2} \cdot \left(\left(a \cdot 3\right) \cdot c\right)}{b}}{3 \cdot a}\\

\end{array}
double f(double a, double b, double c) {
        double r89462 = b;
        double r89463 = -r89462;
        double r89464 = r89462 * r89462;
        double r89465 = 3.0;
        double r89466 = a;
        double r89467 = r89465 * r89466;
        double r89468 = c;
        double r89469 = r89467 * r89468;
        double r89470 = r89464 - r89469;
        double r89471 = sqrt(r89470);
        double r89472 = r89463 + r89471;
        double r89473 = r89472 / r89467;
        return r89473;
}

double f(double a, double b, double c) {
        double r89474 = b;
        double r89475 = -2.272454186637281e+165;
        bool r89476 = r89474 <= r89475;
        double r89477 = -r89474;
        double r89478 = 0.5;
        double r89479 = a;
        double r89480 = 3.0;
        double r89481 = r89479 * r89480;
        double r89482 = c;
        double r89483 = r89481 * r89482;
        double r89484 = r89478 * r89483;
        double r89485 = r89484 / r89474;
        double r89486 = r89485 + r89477;
        double r89487 = r89477 + r89486;
        double r89488 = r89480 * r89479;
        double r89489 = r89487 / r89488;
        double r89490 = 1.7270734494037783e-162;
        bool r89491 = r89474 <= r89490;
        double r89492 = r89474 * r89474;
        double r89493 = r89479 * r89482;
        double r89494 = r89480 * r89493;
        double r89495 = 1.0;
        double r89496 = pow(r89494, r89495);
        double r89497 = r89492 - r89496;
        double r89498 = sqrt(r89497);
        double r89499 = r89477 + r89498;
        double r89500 = r89499 / r89488;
        double r89501 = 5.80649981292105e+110;
        bool r89502 = r89474 <= r89501;
        double r89503 = 0.0;
        double r89504 = r89503 + r89494;
        double r89505 = r89488 * r89482;
        double r89506 = r89492 - r89505;
        double r89507 = sqrt(r89506);
        double r89508 = r89477 - r89507;
        double r89509 = r89504 / r89508;
        double r89510 = r89509 / r89488;
        double r89511 = -0.5;
        double r89512 = r89511 * r89483;
        double r89513 = r89512 / r89474;
        double r89514 = r89513 / r89488;
        double r89515 = r89502 ? r89510 : r89514;
        double r89516 = r89491 ? r89500 : r89515;
        double r89517 = r89476 ? r89489 : r89516;
        return r89517;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b < -2.272454186637281e+165

    1. Initial program 64.0

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied pow164.0

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot \color{blue}{{c}^{1}}}}{3 \cdot a}\]
    4. Applied pow164.0

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot \color{blue}{{a}^{1}}\right) \cdot {c}^{1}}}{3 \cdot a}\]
    5. Applied pow164.0

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(\color{blue}{{3}^{1}} \cdot {a}^{1}\right) \cdot {c}^{1}}}{3 \cdot a}\]
    6. Applied pow-prod-down64.0

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(3 \cdot a\right)}^{1}} \cdot {c}^{1}}}{3 \cdot a}\]
    7. Applied pow-prod-down64.0

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\left(3 \cdot a\right) \cdot c\right)}^{1}}}}{3 \cdot a}\]
    8. Simplified64.0

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - {\color{blue}{\left(3 \cdot \left(a \cdot c\right)\right)}}^{1}}}{3 \cdot a}\]
    9. Using strategy rm
    10. Applied add-sqr-sqrt64.0

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - {\left(\color{blue}{\left(\sqrt{3} \cdot \sqrt{3}\right)} \cdot \left(a \cdot c\right)\right)}^{1}}}{3 \cdot a}\]
    11. Applied associate-*l*64.0

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - {\color{blue}{\left(\sqrt{3} \cdot \left(\sqrt{3} \cdot \left(a \cdot c\right)\right)\right)}}^{1}}}{3 \cdot a}\]
    12. Taylor expanded around -inf 10.6

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(\frac{1}{2} \cdot \frac{a \cdot \left({\left(\sqrt{3}\right)}^{2} \cdot c\right)}{b} - b\right)}}{3 \cdot a}\]
    13. Simplified10.6

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

    if -2.272454186637281e+165 < b < 1.7270734494037783e-162

    1. Initial program 11.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied pow111.1

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot \color{blue}{{c}^{1}}}}{3 \cdot a}\]
    4. Applied pow111.1

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot \color{blue}{{a}^{1}}\right) \cdot {c}^{1}}}{3 \cdot a}\]
    5. Applied pow111.1

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(\color{blue}{{3}^{1}} \cdot {a}^{1}\right) \cdot {c}^{1}}}{3 \cdot a}\]
    6. Applied pow-prod-down11.1

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(3 \cdot a\right)}^{1}} \cdot {c}^{1}}}{3 \cdot a}\]
    7. Applied pow-prod-down11.1

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\left(3 \cdot a\right) \cdot c\right)}^{1}}}}{3 \cdot a}\]
    8. Simplified11.2

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

    if 1.7270734494037783e-162 < b < 5.80649981292105e+110

    1. Initial program 39.2

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied flip-+39.2

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    4. Simplified16.8

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

    if 5.80649981292105e+110 < b

    1. Initial program 60.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied pow160.3

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot \color{blue}{{c}^{1}}}}{3 \cdot a}\]
    4. Applied pow160.3

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot \color{blue}{{a}^{1}}\right) \cdot {c}^{1}}}{3 \cdot a}\]
    5. Applied pow160.3

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(\color{blue}{{3}^{1}} \cdot {a}^{1}\right) \cdot {c}^{1}}}{3 \cdot a}\]
    6. Applied pow-prod-down60.3

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(3 \cdot a\right)}^{1}} \cdot {c}^{1}}}{3 \cdot a}\]
    7. Applied pow-prod-down60.3

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\left(3 \cdot a\right) \cdot c\right)}^{1}}}}{3 \cdot a}\]
    8. Simplified60.3

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - {\color{blue}{\left(3 \cdot \left(a \cdot c\right)\right)}}^{1}}}{3 \cdot a}\]
    9. Using strategy rm
    10. Applied add-sqr-sqrt60.3

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - {\left(\color{blue}{\left(\sqrt{3} \cdot \sqrt{3}\right)} \cdot \left(a \cdot c\right)\right)}^{1}}}{3 \cdot a}\]
    11. Applied associate-*l*60.3

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - {\color{blue}{\left(\sqrt{3} \cdot \left(\sqrt{3} \cdot \left(a \cdot c\right)\right)\right)}}^{1}}}{3 \cdot a}\]
    12. Taylor expanded around inf 14.7

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{a \cdot \left({\left(\sqrt{3}\right)}^{2} \cdot c\right)}{b}}}{3 \cdot a}\]
    13. Simplified14.5

      \[\leadsto \frac{\color{blue}{\frac{\frac{-1}{2} \cdot \left(\left(a \cdot 3\right) \cdot c\right)}{b}}}{3 \cdot a}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification13.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.2724541866372811 \cdot 10^{165}:\\ \;\;\;\;\frac{\left(-b\right) + \left(\frac{\frac{1}{2} \cdot \left(\left(a \cdot 3\right) \cdot c\right)}{b} + \left(-b\right)\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le 1.72707344940377835 \cdot 10^{-162}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - {\left(3 \cdot \left(a \cdot c\right)\right)}^{1}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 5.80649981292105005 \cdot 10^{110}:\\ \;\;\;\;\frac{\frac{0 + 3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{-1}{2} \cdot \left(\left(a \cdot 3\right) \cdot c\right)}{b}}{3 \cdot a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020047 
(FPCore (a b c)
  :name "Cubic critical"
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))