Average Error: 33.9 → 6.7
Time: 23.0s
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 -5.674469085146396739103610609439188639717 \cdot 10^{110}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.409913694611773174476543925182798865564 \cdot 10^{-265}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 1.715181108188238274259588142060201574853 \cdot 10^{78}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \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 -5.674469085146396739103610609439188639717 \cdot 10^{110}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le 1.409913694611773174476543925182798865564 \cdot 10^{-265}:\\
\;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\

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

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\

\end{array}
double f(double a, double b_2, double c) {
        double r88059 = b_2;
        double r88060 = -r88059;
        double r88061 = r88059 * r88059;
        double r88062 = a;
        double r88063 = c;
        double r88064 = r88062 * r88063;
        double r88065 = r88061 - r88064;
        double r88066 = sqrt(r88065);
        double r88067 = r88060 - r88066;
        double r88068 = r88067 / r88062;
        return r88068;
}

double f(double a, double b_2, double c) {
        double r88069 = b_2;
        double r88070 = -5.674469085146397e+110;
        bool r88071 = r88069 <= r88070;
        double r88072 = -0.5;
        double r88073 = c;
        double r88074 = r88073 / r88069;
        double r88075 = r88072 * r88074;
        double r88076 = 1.4099136946117732e-265;
        bool r88077 = r88069 <= r88076;
        double r88078 = r88069 * r88069;
        double r88079 = a;
        double r88080 = r88079 * r88073;
        double r88081 = r88078 - r88080;
        double r88082 = sqrt(r88081);
        double r88083 = r88082 - r88069;
        double r88084 = r88073 / r88083;
        double r88085 = 1.7151811081882383e+78;
        bool r88086 = r88069 <= r88085;
        double r88087 = -r88069;
        double r88088 = r88087 - r88082;
        double r88089 = 1.0;
        double r88090 = r88089 / r88079;
        double r88091 = r88088 * r88090;
        double r88092 = -2.0;
        double r88093 = r88069 / r88079;
        double r88094 = r88092 * r88093;
        double r88095 = r88086 ? r88091 : r88094;
        double r88096 = r88077 ? r88084 : r88095;
        double r88097 = r88071 ? r88075 : r88096;
        return r88097;
}

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 4 regimes
  2. if b_2 < -5.674469085146397e+110

    1. Initial program 59.7

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 2.7

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]

    if -5.674469085146397e+110 < b_2 < 1.4099136946117732e-265

    1. Initial program 31.8

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

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

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

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity16.1

      \[\leadsto \frac{\frac{c \cdot a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{1 \cdot a}}\]
    8. Applied *-un-lft-identity16.1

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{c \cdot a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{1 \cdot a}\]
    9. Applied times-frac16.1

      \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{\frac{c \cdot a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}}\]
    10. Simplified16.1

      \[\leadsto \color{blue}{1} \cdot \frac{\frac{c \cdot a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\]
    11. Simplified8.7

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

    if 1.4099136946117732e-265 < b_2 < 1.7151811081882383e+78

    1. Initial program 8.5

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

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

    if 1.7151811081882383e+78 < b_2

    1. Initial program 43.0

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

      \[\leadsto \frac{\color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    4. Simplified61.8

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Simplified61.8

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity61.8

      \[\leadsto \frac{\frac{c \cdot a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{1 \cdot a}}\]
    8. Applied *-un-lft-identity61.8

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{c \cdot a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{1 \cdot a}\]
    9. Applied times-frac61.8

      \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{\frac{c \cdot a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}}\]
    10. Simplified61.8

      \[\leadsto \color{blue}{1} \cdot \frac{\frac{c \cdot a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\]
    11. Simplified61.6

      \[\leadsto 1 \cdot \color{blue}{\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\]
    12. Taylor expanded around 0 4.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -5.674469085146396739103610609439188639717 \cdot 10^{110}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.409913694611773174476543925182798865564 \cdot 10^{-265}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 1.715181108188238274259588142060201574853 \cdot 10^{78}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019303 
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))