Average Error: 33.5 → 23.6
Time: 13.3s
Precision: 64
Internal Precision: 128
\[\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 5.8033656073298216 \cdot 10^{-40}:\\ \;\;\;\;\left(\sqrt{\left(c \cdot a\right) \cdot -3 + b \cdot b} - b\right) \cdot \frac{1}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(c \cdot a\right) \cdot -3}{\left(a \cdot 3\right) \cdot \left(b + \sqrt{\left(c \cdot a\right) \cdot -3 + b \cdot b}\right)}\\ \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 2 regimes
  2. if b < 5.8033656073298216e-40

    1. Initial program 21.3

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

      \[\leadsto \color{blue}{\frac{\sqrt{-3 \cdot \left(c \cdot a\right) + b \cdot b} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied div-inv21.4

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

    if 5.8033656073298216e-40 < b

    1. Initial program 54.4

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

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

      \[\leadsto \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}}}{3 \cdot a}\]
    5. Applied associate-/l/55.4

      \[\leadsto \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}{\left(3 \cdot a\right) \cdot \left(\sqrt{-3 \cdot \left(c \cdot a\right) + b \cdot b} + b\right)}}\]
    6. Simplified27.4

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

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

Reproduce

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

Details

Time bar (total: 12.1s)Debug log

sample210.0ms

Algorithm
intervals

simplify101.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
101.0ms
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))

prune24.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 32.9b

localize22.0ms

Local error

Found 4 expressions with local error:

21.5b
(sqrt (+ (* -3 (* c a)) (* b b)))
1.9b
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
0.5b
(/ (- (sqrt (+ (* -3 (* c a)) (* b b))) b) (* 3 a))
0.4b
(+ (* -3 (* c a)) (* b b))

rewrite54.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
add-log-exp
add-exp-log
add-cbrt-cube
pow1
associate-/l*
sqrt-prod
times-frac
associate-/l/
flip--
flip-+
sqrt-div
flip3--
flip3-+
div-inv
div-exp
div-sub
pow1/2
frac-2neg
sub-neg
sum-log
associate-/r*
clear-num
rem-sqrt-square
+-commutative
cbrt-undiv
Counts
4 → 58
Calls
4 calls:
Slowest
32.0ms
(/ (- (sqrt (+ (* -3 (* c a)) (* b b))) b) (* 3 a))
16.0ms
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
3.0ms
(+ (* -3 (* c a)) (* b b))
2.0ms
(sqrt (+ (* -3 (* c a)) (* b b)))

series262.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
86.0ms
(/ (- (sqrt (+ (* -3 (* c a)) (* b b))) b) (* 3 a))
76.0ms
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
60.0ms
(sqrt (+ (* -3 (* c a)) (* b b)))
41.0ms
(+ (* -3 (* c a)) (* b b))

simplify1.5s

Counts
32 → 70
Calls
32 calls:
Slowest
621.0ms
(- (* (sqrt (+ (* -3 (* c a)) (* b b))) (sqrt (+ (* -3 (* c a)) (* b b)))) (* b b))
212.0ms
(sqrt (- (* (* -3 (* c a)) (* -3 (* c a))) (* (* b b) (* b b))))
163.0ms
(sqrt (+ (pow (* -3 (* c a)) 3) (pow (* b b) 3)))
89.0ms
(- (pow (sqrt (+ (* -3 (* c a)) (* b b))) 3) (pow b 3))
77.0ms
(/ (* (* (- (sqrt (+ (* -3 (* c a)) (* b b))) b) (- (sqrt (+ (* -3 (* c a)) (* b b))) b)) (- (sqrt (+ (* -3 (* c a)) (* b b))) b)) (* (* (* 3 a) (* 3 a)) (* 3 a)))

prune906.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 21.4b

localize12.0ms

Local error

Found 4 expressions with local error:

21.5b
(sqrt (+ (* -3 (* c a)) (* b b)))
1.9b
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
0.4b
(+ (* -3 (* c a)) (* b b))
0.3b
(* -3 (* c a))

rewrite35.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
add-exp-log
add-cbrt-cube
pow1
sqrt-prod
flip-+
sqrt-div
flip3-+
flip--
*-commutative
associate-*r*
pow1/2
flip3--
sub-neg
sum-log
rem-sqrt-square
+-commutative
Counts
4 → 45
Calls
4 calls:
Slowest
23.0ms
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
5.0ms
(+ (* -3 (* c a)) (* b b))
4.0ms
(sqrt (+ (* -3 (* c a)) (* b b)))
2.0ms
(* -3 (* c a))

series141.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
54.0ms
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
45.0ms
(sqrt (+ (* -3 (* c a)) (* b b)))
31.0ms
(+ (* -3 (* c a)) (* b b))
10.0ms
(* -3 (* c a))

simplify591.0ms

Counts
19 → 57
Calls
19 calls:
Slowest
183.0ms
(sqrt (- (* (* -3 (* c a)) (* -3 (* c a))) (* (* b b) (* b b))))
171.0ms
(sqrt (+ (pow (* -3 (* c a)) 3) (pow (* b b) 3)))
46.0ms
(- (pow b 2) (* 3 (* a c)))
46.0ms
(- (pow b 2) (* 3 (* a c)))
27.0ms
(* (exp (* -3 (* c a))) (exp (* b b)))

prune653.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 21.4b

localize6.0ms

Local error

Found 4 expressions with local error:

21.5b
(sqrt (+ (* -3 (* c a)) (* b b)))
1.9b
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
0.5b
(/ 1 (* 3 a))
0.4b
(+ (* -3 (* c a)) (* b b))

rewrite19.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
add-sqr-sqrt
add-cube-cbrt
add-exp-log
*-un-lft-identity
pow1
add-cbrt-cube
sqrt-prod
flip-+
sqrt-div
flip3-+
inv-pow
flip--
pow-flip
div-inv
pow1/2
flip3--
frac-2neg
sub-neg
sum-log
associate-/r*
clear-num
rec-exp
rem-sqrt-square
+-commutative
Counts
4 → 50
Calls
4 calls:
Slowest
13.0ms
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
3.0ms
(+ (* -3 (* c a)) (* b b))
2.0ms
(sqrt (+ (* -3 (* c a)) (* b b)))
1.0ms
(/ 1 (* 3 a))

series159.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
56.0ms
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
47.0ms
(sqrt (+ (* -3 (* c a)) (* b b)))
40.0ms
(+ (* -3 (* c a)) (* b b))
16.0ms
(/ 1 (* 3 a))

simplify608.0ms

Counts
20 → 62
Calls
20 calls:
Slowest
213.0ms
(sqrt (- (* (* -3 (* c a)) (* -3 (* c a))) (* (* b b) (* b b))))
196.0ms
(sqrt (+ (pow (* -3 (* c a)) 3) (pow (* b b) 3)))
42.0ms
(- (pow b 2) (* 3 (* a c)))
42.0ms
(- (pow b 2) (* 3 (* a c)))
27.0ms
(* (exp (* -3 (* c a))) (exp (* b b)))

prune768.0ms

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 21.4b

localize6.0ms

Local error

Found 4 expressions with local error:

21.5b
(sqrt (+ (* -3 (* c a)) (* b b)))
1.9b
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
0.4b
(+ (* -3 (* c a)) (* b b))
0.3b
(* -3 (* c a))

rewrite19.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
add-exp-log
add-cbrt-cube
pow1
sqrt-prod
flip-+
sqrt-div
flip3-+
flip--
*-commutative
associate-*r*
pow1/2
flip3--
sub-neg
sum-log
rem-sqrt-square
+-commutative
Counts
4 → 45
Calls
4 calls:
Slowest
10.0ms
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
4.0ms
(+ (* -3 (* c a)) (* b b))
2.0ms
(sqrt (+ (* -3 (* c a)) (* b b)))
2.0ms
(* -3 (* c a))

series183.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
65.0ms
(sqrt (+ (* -3 (* c a)) (* b b)))
62.0ms
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
38.0ms
(+ (* -3 (* c a)) (* b b))
17.0ms
(* -3 (* c a))

simplify603.0ms

Counts
19 → 57
Calls
19 calls:
Slowest
199.0ms
(sqrt (+ (pow (* -3 (* c a)) 3) (pow (* b b) 3)))
198.0ms
(sqrt (- (* (* -3 (* c a)) (* -3 (* c a))) (* (* b b) (* b b))))
48.0ms
(- (pow b 2) (* 3 (* a c)))
32.0ms
(- (pow b 2) (* 3 (* a c)))
28.0ms
(- (pow b 2) (* 3 (* a c)))

prune578.0ms

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 21.4b

regimes284.0ms

Accuracy

89.4% (1.2b remaining)

Error of 23.6b against oracle of 22.4b and baseline of 33.5b

bsearch123.0ms

end0.0ms

sample4.2s

Algorithm
intervals