Average Error: 33.6 → 9.8
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 -7.034196314912654332684668868227158268874 \cdot 10^{-79}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le 8.230710165919530873446837900046783246104 \cdot 10^{129}:\\ \;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}{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 -7.034196314912654332684668868227158268874 \cdot 10^{-79}:\\
\;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\

\mathbf{elif}\;b_2 \le 8.230710165919530873446837900046783246104 \cdot 10^{129}:\\
\;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}{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 r16070 = b_2;
        double r16071 = -r16070;
        double r16072 = r16070 * r16070;
        double r16073 = a;
        double r16074 = c;
        double r16075 = r16073 * r16074;
        double r16076 = r16072 - r16075;
        double r16077 = sqrt(r16076);
        double r16078 = r16071 - r16077;
        double r16079 = r16078 / r16073;
        return r16079;
}

double f(double a, double b_2, double c) {
        double r16080 = b_2;
        double r16081 = -7.034196314912654e-79;
        bool r16082 = r16080 <= r16081;
        double r16083 = 1.0;
        double r16084 = -0.5;
        double r16085 = c;
        double r16086 = r16085 / r16080;
        double r16087 = r16084 * r16086;
        double r16088 = r16083 * r16087;
        double r16089 = 8.230710165919531e+129;
        bool r16090 = r16080 <= r16089;
        double r16091 = -r16080;
        double r16092 = a;
        double r16093 = r16092 * r16085;
        double r16094 = -r16093;
        double r16095 = fma(r16080, r16080, r16094);
        double r16096 = sqrt(r16095);
        double r16097 = r16091 - r16096;
        double r16098 = r16097 / r16092;
        double r16099 = r16083 * r16098;
        double r16100 = 0.5;
        double r16101 = r16100 * r16086;
        double r16102 = 2.0;
        double r16103 = r16080 / r16092;
        double r16104 = r16102 * r16103;
        double r16105 = r16101 - r16104;
        double r16106 = r16083 * r16105;
        double r16107 = r16090 ? r16099 : r16106;
        double r16108 = r16082 ? r16088 : r16107;
        return r16108;
}

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if b_2 < -7.034196314912654e-79

    1. Initial program 52.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num52.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 fma-neg52.9

      \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity52.9

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}\right)}}}\]
    8. Applied *-un-lft-identity52.9

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}}\]
    10. Applied add-cube-cbrt52.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{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}\]
    11. Applied times-frac52.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{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}}\]
    12. Simplified52.9

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{a}{\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}\]
    13. Simplified52.8

      \[\leadsto 1 \cdot \color{blue}{\frac{\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}{a}}\]
    14. Taylor expanded around -inf 9.0

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

    if -7.034196314912654e-79 < b_2 < 8.230710165919531e+129

    1. Initial program 12.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num12.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 fma-neg12.2

      \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity12.2

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}\right)}}}\]
    8. Applied *-un-lft-identity12.2

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}}\]
    10. Applied add-cube-cbrt12.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{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}\]
    11. Applied times-frac12.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{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}}\]
    12. Simplified12.2

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{a}{\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}\]
    13. Simplified12.1

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

    if 8.230710165919531e+129 < b_2

    1. Initial program 54.6

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

      \[\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 fma-neg54.7

      \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity54.7

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}\right)}}}\]
    8. Applied *-un-lft-identity54.7

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}}\]
    10. Applied add-cube-cbrt54.7

      \[\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{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}\]
    11. Applied times-frac54.7

      \[\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{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}}\]
    12. Simplified54.7

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{a}{\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}}\]
    13. Simplified54.6

      \[\leadsto 1 \cdot \color{blue}{\frac{\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}{a}}\]
    14. Taylor expanded around inf 3.2

      \[\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 simplification9.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -7.034196314912654332684668868227158268874 \cdot 10^{-79}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le 8.230710165919530873446837900046783246104 \cdot 10^{129}:\\ \;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}{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 2019356 +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))