Average Error: 34.4 → 6.8
Time: 2.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}\;-\left(b + b\right) \le -3.353832252491716 \cdot 10^{+126}:\\ \;\;\;\;\frac{c}{-\left(b + b\right)}\\ \mathbf{if}\;-\left(b + b\right) \le 5.629476504120747 \cdot 10^{-306}:\\ \;\;\;\;\frac{1}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}} \cdot c\\ \mathbf{if}\;-\left(b + b\right) \le 7.950651731113517 \cdot 10^{+58}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot \frac{3}{2}}{\frac{b}{c}} - \left(b + b\right)}{3 \cdot 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) (- b)) < -3.353832252491716e+126

    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 *-un-lft-identity33.4

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

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

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

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

      \[\leadsto c \cdot \color{blue}{\frac{1}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}\]
    11. Using strategy rm
    12. Applied add-exp-log32.6

      \[\leadsto c \cdot \frac{1}{\left(-b\right) - \color{blue}{e^{\log \left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}\]
    13. Taylor expanded around inf 5.0

      \[\leadsto c \cdot \frac{1}{\color{blue}{-\left(e^{-\log \left(\frac{1}{b}\right)} + b\right)}}\]
    14. Applied simplify1.7

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

    if -3.353832252491716e+126 < (+ (- b) (- b)) < 5.629476504120747e-306

    1. Initial program 33.9

      \[\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.0

      \[\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 *-un-lft-identity16.8

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

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

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

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

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

    if 5.629476504120747e-306 < (+ (- b) (- b)) < 7.950651731113517e+58

    1. Initial program 9.8

      \[\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*9.8

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

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

    if 7.950651731113517e+58 < (+ (- b) (- b))

    1. Initial program 39.5

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

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;-\left(b + b\right) \le -3.353832252491716 \cdot 10^{+126}:\\ \;\;\;\;\frac{c}{-\left(b + b\right)}\\ \mathbf{if}\;-\left(b + b\right) \le 5.629476504120747 \cdot 10^{-306}:\\ \;\;\;\;\frac{1}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}} \cdot c\\ \mathbf{if}\;-\left(b + b\right) \le 7.950651731113517 \cdot 10^{+58}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot \frac{3}{2}}{\frac{b}{c}} - \left(b + b\right)}{3 \cdot a}\\ \end{array}}\]

Runtime

Time bar (total: 2.6m)Debug logProfile

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