Average Error: 33.2 → 10.4
Time: 18.6s
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 -6.606954052292902 \cdot 10^{+151}:\\ \;\;\;\;\frac{\frac{\frac{3}{2} \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3}}{a}\\ \mathbf{elif}\;b \le 3.487193979664337 \cdot 10^{-138}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{a \cdot 3}\\ \mathbf{elif}\;b \le 2.676139023673009 \cdot 10^{+61}:\\ \;\;\;\;\frac{3 \cdot \left(a \cdot c\right)}{\left(a \cdot 3\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}\right)}\\ \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 4 regimes
  2. if b < -6.606954052292902e+151

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

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

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

    if -6.606954052292902e+151 < b < 3.487193979664337e-138

    1. Initial program 10.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.8

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

    if 3.487193979664337e-138 < b < 2.676139023673009e+61

    1. Initial program 38.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-+38.7

      \[\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 associate-/l/42.2

      \[\leadsto \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(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    5. Simplified20.2

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

    if 2.676139023673009e+61 < b

    1. Initial program 56.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -6.606954052292902 \cdot 10^{+151}:\\ \;\;\;\;\frac{\frac{\frac{3}{2} \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3}}{a}\\ \mathbf{elif}\;b \le 3.487193979664337 \cdot 10^{-138}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{a \cdot 3}\\ \mathbf{elif}\;b \le 2.676139023673009 \cdot 10^{+61}:\\ \;\;\;\;\frac{3 \cdot \left(a \cdot c\right)}{\left(a \cdot 3\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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

Details

Time bar (total: 16.9s)Debug log

sample159.0ms

Algorithm
intervals

simplify69.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

69.0ms
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))

prune13.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 29.5b

localize37.0ms

Local error

Found 4 expressions with local error:

19.7b
(sqrt (- (* b b) (* (* 3 a) c)))
0.9b
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
0.2b
(* (* 3 a) c)
0.2b
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))

rewrite68.0ms

Algorithm
rewrite-expression-head
Counts
4 → 60
Calls

4 calls. Slowest were:

50.0ms
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))
10.0ms
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
4.0ms
(* (* 3 a) c)

series236.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

93.0ms
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))
66.0ms
(sqrt (- (* b b) (* (* 3 a) c)))
62.0ms
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
14.0ms
(* (* 3 a) c)

simplify2.2s

Counts
35 → 72
Calls

35 calls. Slowest were:

385.0ms
(sqrt (- (pow (* b b) 3) (pow (* (* 3 a) c) 3)))
308.0ms
(- (* (- b) (- b)) (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))))
233.0ms
(+ (pow (- b) 3) (pow (sqrt (- (* b b) (* (* 3 a) c))) 3))

prune826.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 5.1b

localize6.0ms

Local error

Found 4 expressions with local error:

19.7b
(sqrt (- (* b b) (* (* 3 a) c)))
0.9b
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
0.2b
(* (* 3 a) c)
0.2b
(- (* b b) (* (* 3 a) c))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 48
Calls

4 calls. Slowest were:

8.0ms
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
3.0ms
(* (* 3 a) c)
2.0ms
(sqrt (- (* b b) (* (* 3 a) c)))

series148.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

52.0ms
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
42.0ms
(- (* b b) (* (* 3 a) c))
41.0ms
(sqrt (- (* b b) (* (* 3 a) c)))
12.0ms
(* (* 3 a) c)

simplify1.4s

Counts
21 → 60
Calls

21 calls. Slowest were:

450.0ms
(sqrt (- (pow (* b b) 3) (pow (* (* 3 a) c) 3)))
159.0ms
(sqrt (- (* (* b b) (* b b)) (* (* (* 3 a) c) (* (* 3 a) c))))
148.0ms
(- b (* 3/2 (/ (* a c) b)))

prune836.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 5.1b

localize26.0ms

Local error

Found 4 expressions with local error:

19.7b
(sqrt (- (* b b) (* 3 (* a c))))
0.9b
(+ (- b) (sqrt (- (* b b) (* 3 (* a c)))))
0.3b
(* 3 (* a c))
0.2b
(/ (+ (- b) (sqrt (- (* b b) (* 3 (* a c))))) (* 3 a))

rewrite40.0ms

Algorithm
rewrite-expression-head
Counts
4 → 60
Calls

4 calls. Slowest were:

23.0ms
(/ (+ (- b) (sqrt (- (* b b) (* 3 (* a c))))) (* 3 a))
11.0ms
(+ (- b) (sqrt (- (* b b) (* 3 (* a c)))))
4.0ms
(sqrt (- (* b b) (* 3 (* a c))))

series232.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

90.0ms
(/ (+ (- b) (sqrt (- (* b b) (* 3 (* a c))))) (* 3 a))
73.0ms
(+ (- b) (sqrt (- (* b b) (* 3 (* a c)))))
52.0ms
(sqrt (- (* b b) (* 3 (* a c))))
18.0ms
(* 3 (* a c))

simplify2.2s

Counts
35 → 72
Calls

35 calls. Slowest were:

394.0ms
(sqrt (- (pow (* b b) 3) (pow (* 3 (* a c)) 3)))
279.0ms
(- (* (- b) (- b)) (* (sqrt (- (* b b) (* 3 (* a c)))) (sqrt (- (* b b) (* 3 (* a c))))))
273.0ms
(+ (pow (- b) 3) (pow (sqrt (- (* b b) (* 3 (* a c)))) 3))

prune951.0ms

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 5.1b

localize42.0ms

Local error

Found 4 expressions with local error:

19.7b
(sqrt (+ (* c (* a -3)) (* b b)))
0.9b
(- (sqrt (+ (* c (* a -3)) (* b b))) b)
0.3b
(* 1/3 (/ (- (sqrt (+ (* c (* a -3)) (* b b))) b) a))
0.2b
(* c (* a -3))

rewrite41.0ms

Algorithm
rewrite-expression-head
Counts
4 → 47
Calls

4 calls. Slowest were:

21.0ms
(- (sqrt (+ (* c (* a -3)) (* b b))) b)
14.0ms
(* 1/3 (/ (- (sqrt (+ (* c (* a -3)) (* b b))) b) a))
5.0ms
(sqrt (+ (* c (* a -3)) (* b b)))

series166.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

57.0ms
(* 1/3 (/ (- (sqrt (+ (* c (* a -3)) (* b b))) b) a))
51.0ms
(- (sqrt (+ (* c (* a -3)) (* b b))) b)
44.0ms
(sqrt (+ (* c (* a -3)) (* b b)))
13.0ms
(* c (* a -3))

simplify547.0ms

Counts
22 → 59
Calls

22 calls. Slowest were:

204.0ms
(sqrt (- (* (* c (* a -3)) (* c (* a -3))) (* (* b b) (* b b))))
150.0ms
(sqrt (+ (pow (* c (* a -3)) 3) (pow (* b b) 3)))
30.0ms
(cbrt (/ (- (sqrt (+ (* c (* a -3)) (* b b))) b) a))

prune662.0ms

Pruning

12 alts after pruning (10 fresh and 2 done)

Merged error: 5.1b

regimes886.0ms

Accuracy

82.9% (4.7b remaining)

Error of 10.4b against oracle of 5.6b and baseline of 33.2b

bsearch421.0ms

end0.0ms

sample4.6s

Algorithm
intervals