Average Error: 33.2 → 7.2
Time: 3.5m
Precision: 64
Internal Precision: 3392
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -4.716965670945614 \cdot 10^{+37}:\\ \;\;\;\;\frac{\frac{-c}{b/2}}{\frac{1}{\frac{1}{2}}}\\ \mathbf{if}\;b/2 \le -1.6276309842825124 \cdot 10^{-141}:\\ \;\;\;\;\left(\sqrt[3]{\frac{c}{\sqrt{b/2 \cdot b/2 - c \cdot a} - b/2}} \cdot \sqrt[3]{\frac{c}{\sqrt{b/2 \cdot b/2 - c \cdot a} - b/2}}\right) \cdot \sqrt[3]{\frac{c}{\sqrt{b/2 \cdot b/2 - c \cdot a} - b/2}}\\ \mathbf{if}\;b/2 \le 1.0989486611216948 \cdot 10^{+147}:\\ \;\;\;\;\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a}{b/2} \cdot \left(\frac{1}{2} \cdot c\right) - \left(b/2 + b/2\right)}{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 < -4.716965670945614e+37

    1. Initial program 56.4

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

      \[\leadsto \frac{\left(-b/2\right) - \color{blue}{\left(\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - b/2\right)}}{a}\]
    3. Applied simplify4.4

      \[\leadsto \color{blue}{\frac{\frac{-c}{b/2}}{\frac{1}{\frac{1}{2}}}}\]

    if -4.716965670945614e+37 < b/2 < -1.6276309842825124e-141

    1. Initial program 35.2

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

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

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{\sqrt{b/2 \cdot b/2 - a \cdot c} - b/2}}}{a}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt16.5

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

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{c}{\sqrt{b/2 \cdot b/2 - c \cdot a} - b/2}} \cdot \sqrt[3]{\frac{c}{\sqrt{b/2 \cdot b/2 - c \cdot a} - b/2}}\right)} \cdot \sqrt[3]{\frac{\frac{c \cdot a}{\sqrt{b/2 \cdot b/2 - a \cdot c} - b/2}}{a}}\]
    9. Applied simplify6.5

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

    if -1.6276309842825124e-141 < b/2 < 1.0989486611216948e+147

    1. Initial program 10.6

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

    if 1.0989486611216948e+147 < b/2

    1. Initial program 58.3

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

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

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

Runtime

Time bar (total: 3.5m)Debug logProfile

herbie shell --seed '#(341049388 4193966283 3776730818 3836052170 128576249 3840315966)' 
(FPCore (a b/2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))