Average Error: 34.2 → 10.3
Time: 5.2s
Precision: 64
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -3.429521559957367003973909183894614803551 \cdot 10^{-36}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le 7.895438119410103188352046975315827374151 \cdot 10^{91}:\\ \;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\right)\\ \end{array}\]
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
\mathbf{if}\;b_2 \le -3.429521559957367003973909183894614803551 \cdot 10^{-36}:\\
\;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\

\mathbf{elif}\;b_2 \le 7.895438119410103188352046975315827374151 \cdot 10^{91}:\\
\;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\

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

\end{array}
double f(double a, double b_2, double c) {
        double r15575 = b_2;
        double r15576 = -r15575;
        double r15577 = r15575 * r15575;
        double r15578 = a;
        double r15579 = c;
        double r15580 = r15578 * r15579;
        double r15581 = r15577 - r15580;
        double r15582 = sqrt(r15581);
        double r15583 = r15576 - r15582;
        double r15584 = r15583 / r15578;
        return r15584;
}

double f(double a, double b_2, double c) {
        double r15585 = b_2;
        double r15586 = -3.429521559957367e-36;
        bool r15587 = r15585 <= r15586;
        double r15588 = 1.0;
        double r15589 = -0.5;
        double r15590 = c;
        double r15591 = r15590 / r15585;
        double r15592 = r15589 * r15591;
        double r15593 = r15588 * r15592;
        double r15594 = 7.895438119410103e+91;
        bool r15595 = r15585 <= r15594;
        double r15596 = -r15585;
        double r15597 = r15585 * r15585;
        double r15598 = a;
        double r15599 = r15598 * r15590;
        double r15600 = r15597 - r15599;
        double r15601 = sqrt(r15600);
        double r15602 = r15596 - r15601;
        double r15603 = r15602 / r15598;
        double r15604 = r15588 * r15603;
        double r15605 = 0.5;
        double r15606 = r15605 * r15591;
        double r15607 = 2.0;
        double r15608 = r15585 / r15598;
        double r15609 = r15607 * r15608;
        double r15610 = r15606 - r15609;
        double r15611 = r15588 * r15610;
        double r15612 = r15595 ? r15604 : r15611;
        double r15613 = r15587 ? r15593 : r15612;
        return r15613;
}

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if b_2 < -3.429521559957367e-36

    1. Initial program 54.2

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num54.2

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity54.2

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}}\]
    6. Applied *-un-lft-identity54.2

      \[\leadsto \frac{1}{\frac{\color{blue}{1 \cdot a}}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    7. Applied times-frac54.2

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    8. Applied add-cube-cbrt54.2

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    9. Applied times-frac54.2

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    10. Simplified54.2

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    11. Simplified54.2

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

      \[\leadsto 1 \cdot \color{blue}{\left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)}\]

    if -3.429521559957367e-36 < b_2 < 7.895438119410103e+91

    1. Initial program 14.6

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num14.8

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity14.8

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}}\]
    6. Applied *-un-lft-identity14.8

      \[\leadsto \frac{1}{\frac{\color{blue}{1 \cdot a}}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    7. Applied times-frac14.8

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    8. Applied add-cube-cbrt14.8

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    9. Applied times-frac14.8

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    10. Simplified14.8

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    11. Simplified14.6

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

    if 7.895438119410103e+91 < b_2

    1. Initial program 45.8

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num45.9

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity45.9

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}}\]
    6. Applied *-un-lft-identity45.9

      \[\leadsto \frac{1}{\frac{\color{blue}{1 \cdot a}}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    7. Applied times-frac45.9

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    8. Applied add-cube-cbrt45.9

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    9. Applied times-frac45.9

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    10. Simplified45.9

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    11. Simplified45.8

      \[\leadsto 1 \cdot \color{blue}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    12. Taylor expanded around inf 4.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.429521559957367003973909183894614803551 \cdot 10^{-36}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le 7.895438119410103188352046975315827374151 \cdot 10^{91}:\\ \;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019354 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))