Average Error: 34.7 → 10.1
Time: 6.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 -3.0933810930860765 \cdot 10^{67}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -450366840.8642654:\\ \;\;\;\;\frac{a}{\frac{\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c}{c}} \cdot \frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{elif}\;b_2 \le -2.3901106171036543 \cdot 10^{-123}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 4.2519850167275722 \cdot 10^{125}:\\ \;\;\;\;\frac{1}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \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.0933810930860765 \cdot 10^{67}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\

\mathbf{elif}\;b_2 \le -450366840.8642654:\\
\;\;\;\;\frac{a}{\frac{\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c}{c}} \cdot \frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\

\mathbf{elif}\;b_2 \le -2.3901106171036543 \cdot 10^{-123}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r22035 = b_2;
        double r22036 = -r22035;
        double r22037 = r22035 * r22035;
        double r22038 = a;
        double r22039 = c;
        double r22040 = r22038 * r22039;
        double r22041 = r22037 - r22040;
        double r22042 = sqrt(r22041);
        double r22043 = r22036 + r22042;
        double r22044 = r22043 / r22038;
        return r22044;
}

double f(double a, double b_2, double c) {
        double r22045 = b_2;
        double r22046 = -3.0933810930860765e+67;
        bool r22047 = r22045 <= r22046;
        double r22048 = 0.5;
        double r22049 = c;
        double r22050 = r22049 / r22045;
        double r22051 = r22048 * r22050;
        double r22052 = 2.0;
        double r22053 = a;
        double r22054 = r22045 / r22053;
        double r22055 = r22052 * r22054;
        double r22056 = r22051 - r22055;
        double r22057 = -450366840.86426544;
        bool r22058 = r22045 <= r22057;
        double r22059 = pow(r22045, r22052);
        double r22060 = r22059 - r22059;
        double r22061 = r22053 * r22049;
        double r22062 = r22060 + r22061;
        double r22063 = r22062 / r22049;
        double r22064 = r22053 / r22063;
        double r22065 = -r22045;
        double r22066 = r22045 * r22045;
        double r22067 = r22066 - r22061;
        double r22068 = sqrt(r22067);
        double r22069 = r22065 + r22068;
        double r22070 = r22069 / r22053;
        double r22071 = r22064 * r22070;
        double r22072 = -2.3901106171036543e-123;
        bool r22073 = r22045 <= r22072;
        double r22074 = 4.251985016727572e+125;
        bool r22075 = r22045 <= r22074;
        double r22076 = 1.0;
        double r22077 = r22065 - r22068;
        double r22078 = r22077 / r22049;
        double r22079 = r22076 / r22078;
        double r22080 = -0.5;
        double r22081 = r22080 * r22050;
        double r22082 = r22075 ? r22079 : r22081;
        double r22083 = r22073 ? r22056 : r22082;
        double r22084 = r22058 ? r22071 : r22083;
        double r22085 = r22047 ? r22056 : r22084;
        return r22085;
}

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 < -3.0933810930860765e+67 or -450366840.86426544 < b_2 < -2.3901106171036543e-123

    1. Initial program 28.2

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

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

    if -3.0933810930860765e+67 < b_2 < -450366840.86426544

    1. Initial program 5.1

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+52.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. Simplified52.2

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

      \[\leadsto \frac{\frac{0 + a \cdot c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{\color{blue}{1 \cdot a}}\]
    7. Applied flip--52.2

      \[\leadsto \frac{\frac{0 + a \cdot c}{\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}}}}}{1 \cdot a}\]
    8. Applied associate-/r/52.2

      \[\leadsto \frac{\color{blue}{\frac{0 + a \cdot c}{\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}} \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{1 \cdot a}\]
    9. Applied times-frac52.2

      \[\leadsto \color{blue}{\frac{\frac{0 + a \cdot c}{\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}}}{1} \cdot \frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    10. Simplified13.6

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

    if -2.3901106171036543e-123 < b_2 < 4.251985016727572e+125

    1. Initial program 28.7

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+29.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. Simplified16.9

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

      \[\leadsto \frac{\frac{0 + a \cdot c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{\color{blue}{1 \cdot a}}\]
    7. Applied associate-/r*16.9

      \[\leadsto \color{blue}{\frac{\frac{\frac{0 + a \cdot c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{1}}{a}}\]
    8. Simplified15.2

      \[\leadsto \frac{\color{blue}{\frac{a}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{c}}}}{a}\]
    9. Using strategy rm
    10. Applied clear-num15.2

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

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

    if 4.251985016727572e+125 < b_2

    1. Initial program 61.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.0933810930860765 \cdot 10^{67}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -450366840.8642654:\\ \;\;\;\;\frac{a}{\frac{\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c}{c}} \cdot \frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{elif}\;b_2 \le -2.3901106171036543 \cdot 10^{-123}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 4.2519850167275722 \cdot 10^{125}:\\ \;\;\;\;\frac{1}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Reproduce

herbie shell --seed 2020083 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  :precision binary64
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))