Average Error: 33.0 → 11.2
Time: 5.6m
Precision: 64
Internal Precision: 3392
\[\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 -1.3508386715569754 \cdot 10^{+78}:\\ \;\;\;\;\frac{\frac{3}{2} \cdot \frac{c \cdot a}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{if}\;b \le 7.052461812591394 \cdot 10^{-43}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 3}{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{\frac{3}{2} \cdot c}{\frac{b}{a}} - 2 \cdot b}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if b < -1.3508386715569754e+78

    1. Initial program 40.0

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

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

    if -1.3508386715569754e+78 < b < 7.052461812591394e-43

    1. Initial program 14.4

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

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

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

    if 7.052461812591394e-43 < b

    1. Initial program 53.2

      \[\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-+53.2

      \[\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 simplify24.5

      \[\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}\]
    5. Taylor expanded around inf 18.4

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

      \[\leadsto \color{blue}{\frac{c}{\frac{\frac{3}{2} \cdot c}{\frac{b}{a}} - 2 \cdot b}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 5.6m)Debug logProfile

herbie shell --seed '#(1072743783 989954326 4239155542 3782239461 3602631542 1719177920)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))