Average Error: 34.4 → 5.6
Time: 13.2s
Precision: 64
Internal precision: 1920
\[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -3.4957056054812805 \cdot 10^{+36}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 1.480546662792471 \cdot 10^{-175}:\\ \;\;\;\;\left(\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;b/2 \le 1.4004343880412904 \cdot 10^{+131}:\\ \;\;\;\;{\left(\sqrt[3]{\frac{c}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}\right)}^3\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(a \cdot \frac{1}{2}\right) \cdot \frac{c}{b/2} - \left(b/2 + b/2\right)}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b/2

Bits error versus c

Derivation

  1. Split input into 4 regimes.
  2. if b/2 < -3.4957056054812805e+36

    1. Initial program 39.8

      \[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Applied taylor 0

      \[\leadsto -2 \cdot \frac{b/2}{a}\]
    3. Taylor expanded around -inf 0

      \[\leadsto \color{blue}{-2 \cdot \frac{b/2}{a}}\]

    if -3.4957056054812805e+36 < b/2 < 1.480546662792471e-175

    1. Initial program 10.8

      \[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied div-inv 11.0

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

    if 1.480546662792471e-175 < b/2 < 1.4004343880412904e+131

    1. Initial program 38.4

      \[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+ 38.5

      \[\leadsto \frac{\color{blue}{\frac{{\left(-b/2\right)}^2 - {\left(\sqrt{{b/2}^2 - a \cdot c}\right)}^2}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}}{a}\]
    4. Applied simplify 15.6

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt 16.3

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\frac{\frac{c \cdot a}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}{a}}\right)}^3}\]
    7. Applied simplify 7.3

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

    if 1.4004343880412904e+131 < b/2

    1. Initial program 60.9

      \[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+ 60.9

      \[\leadsto \frac{\color{blue}{\frac{{\left(-b/2\right)}^2 - {\left(\sqrt{{b/2}^2 - a \cdot c}\right)}^2}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}}{a}\]
    4. Applied simplify 36.4

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt 36.5

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\frac{\frac{c \cdot a}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}{a}}\right)}^3}\]
    7. Applied simplify 35.5

      \[\leadsto {\color{blue}{\left(\sqrt[3]{\frac{c}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}\right)}}^3\]
    8. Applied taylor 8.1

      \[\leadsto {\left(\sqrt[3]{\frac{c}{\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - 2 \cdot b/2}}\right)}^3\]
    9. Taylor expanded around inf 8.1

      \[\leadsto {\left(\sqrt[3]{\frac{c}{\color{blue}{\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - 2 \cdot b/2}}}\right)}^3\]
    10. Applied simplify 1.1

      \[\leadsto \color{blue}{\frac{c}{\left(a \cdot \frac{1}{2}\right) \cdot \frac{c}{b/2} - \left(b/2 + b/2\right)}}\]
  3. Recombined 4 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 13.2s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1066785882 2324371342 4059510649 1466361199 2701357084 1216585281)'
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))