Average Error: 33.0 → 6.6
Time: 46.6s
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 -8.28610472349374 \cdot 10^{+140}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 1.4081708088564908 \cdot 10^{-288}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}\\ \mathbf{elif}\;b_2 \le 6.523631550102089 \cdot 10^{+89}:\\ \;\;\;\;c \cdot \frac{-1}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{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 -8.28610472349374 \cdot 10^{+140}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\

\mathbf{elif}\;b_2 \le 1.4081708088564908 \cdot 10^{-288}:\\
\;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}\\

\mathbf{elif}\;b_2 \le 6.523631550102089 \cdot 10^{+89}:\\
\;\;\;\;c \cdot \frac{-1}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\

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

\end{array}
double f(double a, double b_2, double c) {
        double r1517264 = b_2;
        double r1517265 = -r1517264;
        double r1517266 = r1517264 * r1517264;
        double r1517267 = a;
        double r1517268 = c;
        double r1517269 = r1517267 * r1517268;
        double r1517270 = r1517266 - r1517269;
        double r1517271 = sqrt(r1517270);
        double r1517272 = r1517265 + r1517271;
        double r1517273 = r1517272 / r1517267;
        return r1517273;
}

double f(double a, double b_2, double c) {
        double r1517274 = b_2;
        double r1517275 = -8.28610472349374e+140;
        bool r1517276 = r1517274 <= r1517275;
        double r1517277 = 0.5;
        double r1517278 = c;
        double r1517279 = r1517278 / r1517274;
        double r1517280 = r1517277 * r1517279;
        double r1517281 = a;
        double r1517282 = r1517274 / r1517281;
        double r1517283 = 2.0;
        double r1517284 = r1517282 * r1517283;
        double r1517285 = r1517280 - r1517284;
        double r1517286 = 1.4081708088564908e-288;
        bool r1517287 = r1517274 <= r1517286;
        double r1517288 = 1.0;
        double r1517289 = r1517274 * r1517274;
        double r1517290 = r1517278 * r1517281;
        double r1517291 = r1517289 - r1517290;
        double r1517292 = sqrt(r1517291);
        double r1517293 = r1517292 - r1517274;
        double r1517294 = r1517281 / r1517293;
        double r1517295 = r1517288 / r1517294;
        double r1517296 = 6.523631550102089e+89;
        bool r1517297 = r1517274 <= r1517296;
        double r1517298 = -1.0;
        double r1517299 = r1517292 + r1517274;
        double r1517300 = r1517298 / r1517299;
        double r1517301 = r1517278 * r1517300;
        double r1517302 = -0.5;
        double r1517303 = r1517279 * r1517302;
        double r1517304 = r1517297 ? r1517301 : r1517303;
        double r1517305 = r1517287 ? r1517295 : r1517304;
        double r1517306 = r1517276 ? r1517285 : r1517305;
        return r1517306;
}

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 < -8.28610472349374e+140

    1. Initial program 55.8

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified55.8

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Taylor expanded around -inf 1.6

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

    if -8.28610472349374e+140 < b_2 < 1.4081708088564908e-288

    1. Initial program 8.7

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified8.7

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Taylor expanded around inf 8.7

      \[\leadsto \frac{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}{a}\]
    4. Simplified8.7

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

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

      \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}} - 1 \cdot b_2}{a}\]
    8. Applied distribute-lft-out--8.7

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}{a}\]
    9. Applied associate-/l*8.9

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

    if 1.4081708088564908e-288 < b_2 < 6.523631550102089e+89

    1. Initial program 32.8

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified32.8

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Taylor expanded around inf 32.8

      \[\leadsto \frac{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}{a}\]
    4. Simplified32.8

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

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

      \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}} - 1 \cdot b_2}{a}\]
    8. Applied distribute-lft-out--32.8

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}{a}\]
    9. Applied associate-/l*32.8

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    10. Using strategy rm
    11. Applied flip--32.9

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - b_2 \cdot b_2}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}}}}\]
    12. Applied associate-/r/33.0

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

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

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

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

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

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

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

    if 6.523631550102089e+89 < b_2

    1. Initial program 58.7

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified58.7

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Taylor expanded around inf 2.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -8.28610472349374 \cdot 10^{+140}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 1.4081708088564908 \cdot 10^{-288}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}\\ \mathbf{elif}\;b_2 \le 6.523631550102089 \cdot 10^{+89}:\\ \;\;\;\;c \cdot \frac{-1}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \end{array}\]

Reproduce

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