Average Error: 33.9 → 7.2
Time: 8.8s
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 -2.2375225949334019 \cdot 10^{57}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.9220534958503673 \cdot 10^{-246}:\\ \;\;\;\;1 \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 1.77017414835012383 \cdot 10^{70}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 \cdot \left(-2 \cdot b_2\right)}{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 -2.2375225949334019 \cdot 10^{57}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot \left(-2 \cdot b_2\right)}{a}\\

\end{array}
double f(double a, double b_2, double c) {
        double r305 = b_2;
        double r306 = -r305;
        double r307 = r305 * r305;
        double r308 = a;
        double r309 = c;
        double r310 = r308 * r309;
        double r311 = r307 - r310;
        double r312 = sqrt(r311);
        double r313 = r306 - r312;
        double r314 = r313 / r308;
        return r314;
}

double f(double a, double b_2, double c) {
        double r315 = b_2;
        double r316 = -2.237522594933402e+57;
        bool r317 = r315 <= r316;
        double r318 = -0.5;
        double r319 = c;
        double r320 = r319 / r315;
        double r321 = r318 * r320;
        double r322 = 1.9220534958503673e-246;
        bool r323 = r315 <= r322;
        double r324 = 1.0;
        double r325 = r315 * r315;
        double r326 = a;
        double r327 = r326 * r319;
        double r328 = r325 - r327;
        double r329 = sqrt(r328);
        double r330 = r329 - r315;
        double r331 = r319 / r330;
        double r332 = r324 * r331;
        double r333 = 1.7701741483501238e+70;
        bool r334 = r315 <= r333;
        double r335 = -r315;
        double r336 = r335 - r329;
        double r337 = r324 / r326;
        double r338 = r336 * r337;
        double r339 = -2.0;
        double r340 = r339 * r315;
        double r341 = r324 * r340;
        double r342 = r341 / r326;
        double r343 = r334 ? r338 : r342;
        double r344 = r323 ? r332 : r343;
        double r345 = r317 ? r321 : r344;
        return r345;
}

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 < -2.237522594933402e+57

    1. Initial program 57.0

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

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

    if -2.237522594933402e+57 < b_2 < 1.9220534958503673e-246

    1. Initial program 28.3

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

      \[\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. Simplified17.0

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

      \[\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-identity17.0

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

      \[\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)}}{a}\]
    9. Applied times-frac17.0

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

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

      \[\leadsto \frac{1 \cdot \color{blue}{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}}{a}\]
    12. Using strategy rm
    13. Applied clear-num14.6

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}{c}}}\]
    15. Using strategy rm
    16. Applied *-un-lft-identity10.6

      \[\leadsto \frac{1}{\frac{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}{\color{blue}{1 \cdot c}}}\]
    17. Applied times-frac10.6

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}\]
    18. Applied add-cube-cbrt10.6

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}\]
    19. Applied times-frac10.6

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}\]
    20. Simplified10.6

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}\]
    21. Simplified10.4

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

    if 1.9220534958503673e-246 < b_2 < 1.7701741483501238e+70

    1. Initial program 8.4

      \[\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.7701741483501238e+70 < b_2

    1. Initial program 41.6

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

      \[\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-identity61.2

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

      \[\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)}}{a}\]
    9. Applied times-frac61.2

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.2375225949334019 \cdot 10^{57}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.9220534958503673 \cdot 10^{-246}:\\ \;\;\;\;1 \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 1.77017414835012383 \cdot 10^{70}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 \cdot \left(-2 \cdot b_2\right)}{a}\\ \end{array}\]

Reproduce

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