Average Error: 33.2 → 7.0
Time: 1.2m
Precision: 64
Internal Precision: 3456
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -1.5493821240145857 \cdot 10^{+112}:\\ \;\;\;\;\frac{c}{\frac{c \cdot \frac{1}{2}}{\frac{b/2}{a}} - \left(b/2 + b/2\right)}\\ \mathbf{if}\;b/2 \le -9.191200241499173 \cdot 10^{-251}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{b/2 \cdot b/2 - c \cdot a} + \left(-b/2\right)}{c}}\\ \mathbf{if}\;b/2 \le 8.170286142842637 \cdot 10^{+118}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \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 < -1.5493821240145857e+112

    1. Initial program 58.9

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

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied clear-num32.5

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\frac{c \cdot a}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}}}\]
    7. Applied simplify30.9

      \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{b/2 \cdot b/2 - c \cdot a} + \left(-b/2\right)}{c}}}\]
    8. Taylor expanded around -inf 6.5

      \[\leadsto \frac{1}{\frac{\color{blue}{\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - 2 \cdot b/2}}{c}}\]
    9. Applied simplify2.2

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

    if -1.5493821240145857e+112 < b/2 < -9.191200241499173e-251

    1. Initial program 34.3

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

      \[\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. Applied simplify16.8

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied clear-num17.0

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

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

    if -9.191200241499173e-251 < b/2 < 8.170286142842637e+118

    1. Initial program 9.5

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num9.7

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

    if 8.170286142842637e+118 < b/2

    1. Initial program 49.5

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

      \[\leadsto \color{blue}{-2 \cdot \frac{b/2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed '#(1063282112 2455465480 4141627379 3773598652 1647277307 776739644)' 
(FPCore (a b/2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))