Average Error: 34.7 → 6.3
Time: 31.0s
Precision: 64
Internal precision: 2944
\[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -4.930770214232589 \cdot 10^{+18}:\\ \;\;\;\;\frac{\left(-b\right) + b}{a + a} - \frac{c}{b}\\ \mathbf{if}\;b \le -4.4891519221511533 \cdot 10^{-128}:\\ \;\;\;\;\frac{\frac{\left(4 \cdot c\right) \cdot a}{a + a}}{\left(-b\right) + \sqrt{{b}^2 - a \cdot \left(c \cdot 4\right)}}\\ \mathbf{if}\;b \le 4.983767219933664 \cdot 10^{+51}:\\ \;\;\;\;\frac{1}{\frac{a + a}{\left(-b\right) - \sqrt{{b}^2 - a \cdot \left(c \cdot 4\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 4 regimes.
  2. if b < -4.930770214232589e+18

    1. Initial program 57.2

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
    2. Applied taylor 41.1

      \[\leadsto \frac{\left(-b\right) - \left(2 \cdot \frac{c \cdot a}{b} - b\right)}{2 \cdot a}\]
    3. Taylor expanded around -inf 41.1

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + b}{a + a} - \frac{\frac{c}{b}}{1}}\]
    5. Applied simplify 0

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

    if -4.930770214232589e+18 < b < -4.4891519221511533e-128

    1. Initial program 38.3

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{a + a}{\left(-b\right) - \sqrt{{b}^2 - a \cdot \left(c \cdot 4\right)}}}}\]
    5. Using strategy rm
    6. Applied flip-- 38.4

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

      \[\leadsto \frac{1}{\color{blue}{\frac{a + a}{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - a \cdot \left(c \cdot 4\right)}\right)}^2} \cdot \left(\left(-b\right) + \sqrt{{b}^2 - a \cdot \left(c \cdot 4\right)}\right)}}\]
    8. Applied associate-/r* 38.4

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

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

    if -4.4891519221511533e-128 < b < 4.983767219933664e+51

    1. Initial program 11.5

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

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

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

    if 4.983767219933664e+51 < b

    1. Initial program 39.7

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}}\]
    4. Applied simplify 0

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

Runtime

Time bar (total: 31.0s) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(3052192724 3812927732 3686175817 630908657 2373248591 511094450)'
(FPCore (a b c)
  :name "NMSE p42, negative"
  :pre (and (>= (* b b) (* 4 (* a c))) (!= a 0))
  (/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))