Average Error: 33.4 → 9.2
Time: 2.1m
Precision: 64
Internal Precision: 3200
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -5.731006037655152 \cdot 10^{+88}:\\ \;\;\;\;\frac{\left(\frac{3}{2} \cdot a\right) \cdot \frac{c}{b} - 2 \cdot b}{a \cdot 3}\\ \mathbf{if}\;b \le 4.6193675174066457 \cdot 10^{-302}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - b}{a} \cdot \frac{1}{3}\\ \mathbf{if}\;b \le 1.1915458835240066 \cdot 10^{+37}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Split input into 4 regimes
  2. if b < -5.731006037655152e+88

    1. Initial program 42.1

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

      \[\leadsto \color{blue}{\left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \cdot \frac{1}{3 \cdot a}}\]
    4. Taylor expanded around -inf 10.3

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

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

    if -5.731006037655152e+88 < b < 4.6193675174066457e-302

    1. Initial program 9.0

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity9.0

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a}\]
    4. Applied times-frac9.1

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

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

    if 4.6193675174066457e-302 < b < 1.1915458835240066e+37

    1. Initial program 29.0

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

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

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

    if 1.1915458835240066e+37 < b

    1. Initial program 56.2

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

      \[\leadsto \frac{\color{blue}{\frac{-3}{2} \cdot \frac{c \cdot a}{b}}}{3 \cdot a}\]
    3. Applied simplify5.1

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -5.731006037655152 \cdot 10^{+88}:\\ \;\;\;\;\frac{\left(\frac{3}{2} \cdot a\right) \cdot \frac{c}{b} - 2 \cdot b}{a \cdot 3}\\ \mathbf{if}\;b \le 4.6193675174066457 \cdot 10^{-302}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - b}{a} \cdot \frac{1}{3}\\ \mathbf{if}\;b \le 1.1915458835240066 \cdot 10^{+37}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \end{array}}\]

Runtime

Time bar (total: 2.1m)Debug logProfile

herbie shell --seed '#(1070833653 108281690 3330367898 3632331308 3494323072 43156186)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))