Average Error: 34.7 → 8.9
Time: 5.4s
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 -1.329298386451440676631327446927623911346 \cdot 10^{154}:\\ \;\;\;\;\frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le -8.887624764985494947900416379846939642691 \cdot 10^{-175}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 6.167898436296758304385773759338301434281 \cdot 10^{152}:\\ \;\;\;\;\frac{\frac{c}{1}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{c} \cdot \left(1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b\right)}\\ \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 -1.329298386451440676631327446927623911346 \cdot 10^{154}:\\
\;\;\;\;\frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}{3 \cdot a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r88462 = b;
        double r88463 = -r88462;
        double r88464 = r88462 * r88462;
        double r88465 = 3.0;
        double r88466 = a;
        double r88467 = r88465 * r88466;
        double r88468 = c;
        double r88469 = r88467 * r88468;
        double r88470 = r88464 - r88469;
        double r88471 = sqrt(r88470);
        double r88472 = r88463 + r88471;
        double r88473 = r88472 / r88467;
        return r88473;
}

double f(double a, double b, double c) {
        double r88474 = b;
        double r88475 = -1.3292983864514407e+154;
        bool r88476 = r88474 <= r88475;
        double r88477 = -r88474;
        double r88478 = 1.5;
        double r88479 = a;
        double r88480 = c;
        double r88481 = r88479 * r88480;
        double r88482 = r88481 / r88474;
        double r88483 = r88478 * r88482;
        double r88484 = r88483 - r88474;
        double r88485 = r88477 + r88484;
        double r88486 = 3.0;
        double r88487 = r88486 * r88479;
        double r88488 = r88485 / r88487;
        double r88489 = -8.887624764985495e-175;
        bool r88490 = r88474 <= r88489;
        double r88491 = r88474 * r88474;
        double r88492 = r88487 * r88480;
        double r88493 = r88491 - r88492;
        double r88494 = sqrt(r88493);
        double r88495 = r88477 + r88494;
        double r88496 = r88495 / r88487;
        double r88497 = 6.167898436296758e+152;
        bool r88498 = r88474 <= r88497;
        double r88499 = 1.0;
        double r88500 = r88480 / r88499;
        double r88501 = r88477 - r88494;
        double r88502 = r88500 / r88501;
        double r88503 = 1.0;
        double r88504 = r88499 / r88480;
        double r88505 = 2.0;
        double r88506 = r88505 * r88474;
        double r88507 = r88483 - r88506;
        double r88508 = r88504 * r88507;
        double r88509 = r88503 / r88508;
        double r88510 = r88498 ? r88502 : r88509;
        double r88511 = r88490 ? r88496 : r88510;
        double r88512 = r88476 ? r88488 : r88511;
        return r88512;
}

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 < -1.3292983864514407e+154

    1. Initial program 64.0

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Taylor expanded around -inf 12.1

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

    if -1.3292983864514407e+154 < b < -8.887624764985495e-175

    1. Initial program 7.6

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

    if -8.887624764985495e-175 < b < 6.167898436296758e+152

    1. Initial program 31.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 flip-+31.4

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

      \[\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}\]
    5. Using strategy rm
    6. Applied clear-num16.7

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

      \[\leadsto \frac{1}{\color{blue}{\frac{3 \cdot a}{3 \cdot \left(a \cdot c\right)} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    8. Taylor expanded around 0 10.0

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{c}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\]
    9. Using strategy rm
    10. Applied associate-/r*9.6

      \[\leadsto \color{blue}{\frac{\frac{1}{\frac{1}{c}}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}\]
    11. Simplified9.5

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

    if 6.167898436296758e+152 < b

    1. Initial program 63.8

      \[\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-+63.8

      \[\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. Simplified38.5

      \[\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}\]
    5. Using strategy rm
    6. Applied clear-num38.5

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

      \[\leadsto \frac{1}{\color{blue}{\frac{3 \cdot a}{3 \cdot \left(a \cdot c\right)} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    8. Taylor expanded around 0 38.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.329298386451440676631327446927623911346 \cdot 10^{154}:\\ \;\;\;\;\frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le -8.887624764985494947900416379846939642691 \cdot 10^{-175}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 6.167898436296758304385773759338301434281 \cdot 10^{152}:\\ \;\;\;\;\frac{\frac{c}{1}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{c} \cdot \left(1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b\right)}\\ \end{array}\]

Reproduce

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