Average Error: 28.6 → 16.4
Time: 35.2s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 2299.7080687351895:\\ \;\;\;\;\sqrt[3]{\frac{\frac{\frac{\left(c \cdot a\right) \cdot -4}{b + \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*}}}{2}}{a} \cdot \left(\frac{\frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b \cdot b}{b + \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*}}}{2}}{a} \cdot \frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b}{2}}{a}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{-1}{2}} \cdot \left(\sqrt[3]{2} \cdot \frac{c}{b}\right)\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 2 regimes
  2. if b < 2299.7080687351895

    1. Initial program 17.8

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Simplified17.8

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b}{2}}{a}}\]
    3. Using strategy rm
    4. Applied add-cbrt-cube17.8

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

      \[\leadsto \sqrt[3]{\left(\frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b}{2}}{a} \cdot \frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b}{2}}{a}\right) \cdot \frac{\frac{\color{blue}{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b \cdot b}{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} + b}}}{2}}{a}}\]
    7. Taylor expanded around 0 17.3

      \[\leadsto \sqrt[3]{\left(\frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b}{2}}{a} \cdot \frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b}{2}}{a}\right) \cdot \frac{\frac{\frac{\color{blue}{-4 \cdot \left(a \cdot c\right)}}{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} + b}}{2}}{a}}\]
    8. Using strategy rm
    9. Applied flip--17.2

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

    if 2299.7080687351895 < b

    1. Initial program 37.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Simplified37.3

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b}{2}}{a}}\]
    3. Using strategy rm
    4. Applied add-cbrt-cube37.3

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

      \[\leadsto \sqrt[3]{\left(\frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b}{2}}{a} \cdot \frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b}{2}}{a}\right) \cdot \frac{\frac{\color{blue}{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b \cdot b}{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} + b}}}{2}}{a}}\]
    7. Taylor expanded around 0 36.9

      \[\leadsto \sqrt[3]{\left(\frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b}{2}}{a} \cdot \frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b}{2}}{a}\right) \cdot \frac{\frac{\frac{\color{blue}{-4 \cdot \left(a \cdot c\right)}}{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} + b}}{2}}{a}}\]
    8. Taylor expanded around 0 16.4

      \[\leadsto \color{blue}{e^{\frac{1}{3} \cdot \left(\left(\log 2 + 3 \cdot \log c\right) - 3 \cdot \log b\right)} \cdot \sqrt[3]{\frac{-1}{2}}}\]
    9. Simplified15.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 2299.7080687351895:\\ \;\;\;\;\sqrt[3]{\frac{\frac{\frac{\left(c \cdot a\right) \cdot -4}{b + \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*}}}{2}}{a} \cdot \left(\frac{\frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b \cdot b}{b + \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*}}}{2}}{a} \cdot \frac{\frac{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} - b}{2}}{a}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{-1}{2}} \cdot \left(\sqrt[3]{2} \cdot \frac{c}{b}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019089 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))