Average Error: 33.7 → 13.4
Time: 31.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 -1.6178610581073803 \cdot 10^{+105}:\\ \;\;\;\;\frac{\left(\frac{3}{2} \cdot \frac{a \cdot c}{b} - b\right) + \left(-b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le 1.1900509959959253 \cdot 10^{-128}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b + \left(a \cdot c\right) \cdot -3} - b}{3}}{a}\\ \mathbf{elif}\;b \le 1.4596095085343713 \cdot 10^{+125}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\left(a \cdot c\right) \cdot -3}{a \cdot \left(\sqrt{b \cdot b + \left(a \cdot c\right) \cdot -3} + b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}{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 < -1.6178610581073803e+105

    1. Initial program 45.8

      \[\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{\left(-b\right) + \color{blue}{\left(\frac{3}{2} \cdot \frac{a \cdot c}{b} - b\right)}}{3 \cdot a}\]

    if -1.6178610581073803e+105 < b < 1.1900509959959253e-128

    1. Initial program 11.6

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Initial simplification11.7

      \[\leadsto \frac{\sqrt{-3 \cdot \left(c \cdot a\right) + b \cdot b} - b}{3 \cdot a}\]
    3. Using strategy rm
    4. Applied associate-/r*11.6

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

    if 1.1900509959959253e-128 < b < 1.4596095085343713e+125

    1. Initial program 41.9

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Initial simplification41.9

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

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

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

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

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

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

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

    if 1.4596095085343713e+125 < b

    1. Initial program 60.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.6178610581073803 \cdot 10^{+105}:\\ \;\;\;\;\frac{\left(\frac{3}{2} \cdot \frac{a \cdot c}{b} - b\right) + \left(-b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le 1.1900509959959253 \cdot 10^{-128}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b + \left(a \cdot c\right) \cdot -3} - b}{3}}{a}\\ \mathbf{elif}\;b \le 1.4596095085343713 \cdot 10^{+125}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\left(a \cdot c\right) \cdot -3}{a \cdot \left(\sqrt{b \cdot b + \left(a \cdot c\right) \cdot -3} + b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}{3 \cdot a}\\ \end{array}\]

Runtime

Time bar (total: 31.2s)Debug logProfile

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