Average Error: 33.7 → 10.4
Time: 21.2s
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 -4.5087247841566877 \cdot 10^{+120}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b} - \frac{b}{a} \cdot \frac{2}{3}\\ \mathbf{elif}\;b \le 2.164929437706202 \cdot 10^{-117}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right) + b \cdot b} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{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 < -4.5087247841566877e+120

    1. Initial program 49.1

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

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

    if -4.5087247841566877e+120 < b < 2.164929437706202e-117

    1. Initial program 11.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 sub-neg11.7

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{b \cdot b + \left(-\left(3 \cdot a\right) \cdot c\right)}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity11.7

      \[\leadsto \frac{\left(-b\right) + \color{blue}{1 \cdot \sqrt{b \cdot b + \left(-\left(3 \cdot a\right) \cdot c\right)}}}{3 \cdot a}\]
    6. Applied *-un-lft-identity11.7

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

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

      \[\leadsto \frac{1 \cdot \color{blue}{\left(\sqrt{\left(c \cdot -3\right) \cdot a + b \cdot b} - b\right)}}{3 \cdot a}\]
    9. Using strategy rm
    10. Applied times-frac11.7

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

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

    if 2.164929437706202e-117 < b

    1. Initial program 51.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -4.5087247841566877 \cdot 10^{+120}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b} - \frac{b}{a} \cdot \frac{2}{3}\\ \mathbf{elif}\;b \le 2.164929437706202 \cdot 10^{-117}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right) + b \cdot b} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Runtime

Time bar (total: 21.2s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes33.710.45.827.983.6%
herbie shell --seed 2018290 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))