Average Error: 33.8 → 9.0
Time: 18.5s
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 -1.098619512916649965849050740853908172435 \cdot 10^{69}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 8.458581803714143037308192820432094800229 \cdot 10^{-305}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 3.628799960716311990444092539387346352569 \cdot 10^{50}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2 \cdot -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 -1.098619512916649965849050740853908172435 \cdot 10^{69}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r3552971 = b_2;
        double r3552972 = -r3552971;
        double r3552973 = r3552971 * r3552971;
        double r3552974 = a;
        double r3552975 = c;
        double r3552976 = r3552974 * r3552975;
        double r3552977 = r3552973 - r3552976;
        double r3552978 = sqrt(r3552977);
        double r3552979 = r3552972 - r3552978;
        double r3552980 = r3552979 / r3552974;
        return r3552980;
}

double f(double a, double b_2, double c) {
        double r3552981 = b_2;
        double r3552982 = -1.09861951291665e+69;
        bool r3552983 = r3552981 <= r3552982;
        double r3552984 = -0.5;
        double r3552985 = c;
        double r3552986 = r3552985 / r3552981;
        double r3552987 = r3552984 * r3552986;
        double r3552988 = 8.458581803714143e-305;
        bool r3552989 = r3552981 <= r3552988;
        double r3552990 = a;
        double r3552991 = r3552985 * r3552990;
        double r3552992 = r3552991 / r3552990;
        double r3552993 = r3552981 * r3552981;
        double r3552994 = r3552993 - r3552991;
        double r3552995 = sqrt(r3552994);
        double r3552996 = r3552995 - r3552981;
        double r3552997 = r3552992 / r3552996;
        double r3552998 = 3.628799960716312e+50;
        bool r3552999 = r3552981 <= r3552998;
        double r3553000 = -r3552981;
        double r3553001 = r3553000 - r3552995;
        double r3553002 = r3553001 / r3552990;
        double r3553003 = -2.0;
        double r3553004 = r3552981 * r3553003;
        double r3553005 = r3553004 / r3552990;
        double r3553006 = r3552999 ? r3553002 : r3553005;
        double r3553007 = r3552989 ? r3552997 : r3553006;
        double r3553008 = r3552983 ? r3552987 : r3553007;
        return r3553008;
}

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 < -1.09861951291665e+69

    1. Initial program 57.9

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

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

    if -1.09861951291665e+69 < b_2 < 8.458581803714143e-305

    1. Initial program 30.2

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot \left(0 + a \cdot c\right)}}{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}{1 \cdot a}\]
    10. Applied times-frac16.4

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

      \[\leadsto \color{blue}{\frac{\frac{1}{1}}{1} \cdot \frac{\frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}}\]
    12. Simplified16.4

      \[\leadsto \color{blue}{1} \cdot \frac{\frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\]
    13. Simplified15.8

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

    if 8.458581803714143e-305 < b_2 < 3.628799960716312e+50

    1. Initial program 9.6

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

    if 3.628799960716312e+50 < b_2

    1. Initial program 38.1

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

      \[\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. Simplified60.3

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

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Taylor expanded around 0 6.3

      \[\leadsto \frac{\color{blue}{-2 \cdot b_2}}{a}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.098619512916649965849050740853908172435 \cdot 10^{69}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 8.458581803714143037308192820432094800229 \cdot 10^{-305}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 3.628799960716311990444092539387346352569 \cdot 10^{50}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \end{array}\]

Reproduce

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