Average Error: 34.4 → 6.9
Time: 2.4m
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}\;\frac{b}{\frac{-3}{2}} \le -6.862452068174545 \cdot 10^{+125}:\\ \;\;\;\;\frac{\frac{c}{b}}{-2}\\ \mathbf{if}\;\frac{b}{\frac{-3}{2}} \le -9.915540693267239 \cdot 10^{-291}:\\ \;\;\;\;\frac{1}{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}{c}}\\ \mathbf{if}\;\frac{b}{\frac{-3}{2}} \le 2.586818699748715 \cdot 10^{+67}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b}{\frac{-3}{2}}}{a}\\ \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 4 regimes
  2. if (/ b -3/2) < -6.862452068174545e+125

    1. Initial program 60.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 flip-+60.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 simplify33.4

      \[\leadsto \frac{\frac{\color{blue}{\left(3 \cdot c\right) \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied clear-num33.4

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

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

      \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c}}}\]
    9. Applied simplify1.7

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

    if -6.862452068174545e+125 < (/ b -3/2) < -9.915540693267239e-291

    1. Initial program 34.6

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

      \[\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 simplify16.8

      \[\leadsto \frac{\frac{\color{blue}{\left(3 \cdot c\right) \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied clear-num17.0

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

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

    if -9.915540693267239e-291 < (/ b -3/2) < 2.586818699748715e+67

    1. Initial program 10.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 associate-/r*10.1

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

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

    if 2.586818699748715e+67 < (/ b -3/2)

    1. Initial program 40.7

      \[\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-+61.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 simplify61.2

      \[\leadsto \frac{\frac{\color{blue}{\left(3 \cdot c\right) \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied clear-num61.3

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

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

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

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

Runtime

Time bar (total: 2.4m)Debug logProfile

herbie shell --seed 2020178 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))