Average Error: 33.7 → 15.7
Time: 15.8s
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 -1.127123378506132 \cdot 10^{+57}:\\ \;\;\;\;\frac{\frac{3}{2} \cdot \frac{a \cdot c}{b} - 2 \cdot b}{a \cdot 3}\\ \mathbf{elif}\;b \le 2.0611675014481223:\\ \;\;\;\;\frac{\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}{a \cdot 3}\\ \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 < -1.127123378506132e+57

    1. Initial program 38.3

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

    if -1.127123378506132e+57 < b < 2.0611675014481223

    1. Initial program 17.0

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

      \[\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 associate-*r*17.1

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

    if 2.0611675014481223 < b

    1. Initial program 54.8

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

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

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

Reproduce

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

Details

Time bar (total: 14.2s)Debug log

sample145.0ms

Algorithm
intervals

simplify103.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune15.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 35.3b

localize21.0ms

Local error

Found 4 expressions with local error:

25.7b
(sqrt (- (* b b) (* (* 3 a) c)))
1.5b
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
0.8b
(- (* b b) (* (* 3 a) c))
0.2b
(* (* 3 a) c)

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 48
Calls

4 calls. Slowest were:

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

series183.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

71.0ms
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
67.0ms
(sqrt (- (* b b) (* (* 3 a) c)))
33.0ms
(- (* b b) (* (* 3 a) c))
12.0ms
(* (* 3 a) c)

simplify1.4s

Counts
21 → 60
Calls

21 calls. Slowest were:

422.0ms
(sqrt (- (pow (* b b) 3) (pow (* (* 3 a) c) 3)))
167.0ms
(sqrt (- (* (* b b) (* b b)) (* (* (* 3 a) c) (* (* 3 a) c))))
133.0ms
(- b (* 3/2 (/ (* a c) b)))

prune748.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 11.4b

localize30.0ms

Local error

Found 4 expressions with local error:

25.7b
(sqrt (+ (* -3 (* c a)) (* b b)))
1.5b
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
0.8b
(+ (* -3 (* c a)) (* b b))
0.2b
(* -3 (* c a))

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
4 → 45
Calls

4 calls. Slowest were:

21.0ms
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
5.0ms
(+ (* -3 (* c a)) (* b b))
4.0ms
(sqrt (+ (* -3 (* c a)) (* b b)))

series165.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

52.0ms
(- (sqrt (+ (* -3 (* c a)) (* b b))) b)
51.0ms
(sqrt (+ (* -3 (* c a)) (* b b)))
49.0ms
(+ (* -3 (* c a)) (* b b))
13.0ms
(* -3 (* c a))

simplify629.0ms

Counts
19 → 57
Calls

19 calls. Slowest were:

199.0ms
(sqrt (- (* (* -3 (* c a)) (* -3 (* c a))) (* (* b b) (* b b))))
178.0ms
(sqrt (+ (pow (* -3 (* c a)) 3) (pow (* b b) 3)))
46.0ms
(- (pow b 2) (* 3 (* a c)))

prune650.0ms

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 11.4b

localize15.0ms

Local error

Found 4 expressions with local error:

25.7b
(sqrt (+ (* (* -3 c) a) (* b b)))
1.5b
(- (sqrt (+ (* (* -3 c) a) (* b b))) b)
0.8b
(+ (* (* -3 c) a) (* b b))
0.2b
(* (* -3 c) a)

rewrite45.0ms

Algorithm
rewrite-expression-head
Counts
4 → 45
Calls

4 calls. Slowest were:

29.0ms
(- (sqrt (+ (* (* -3 c) a) (* b b))) b)
7.0ms
(+ (* (* -3 c) a) (* b b))
4.0ms
(* (* -3 c) a)

series187.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

70.0ms
(sqrt (+ (* (* -3 c) a) (* b b)))
59.0ms
(- (sqrt (+ (* (* -3 c) a) (* b b))) b)
42.0ms
(+ (* (* -3 c) a) (* b b))
15.0ms
(* (* -3 c) a)

simplify621.0ms

Counts
19 → 57
Calls

19 calls. Slowest were:

207.0ms
(sqrt (+ (pow (* (* -3 c) a) 3) (pow (* b b) 3)))
198.0ms
(sqrt (- (* (* (* -3 c) a) (* (* -3 c) a)) (* (* b b) (* b b))))
50.0ms
(- (pow b 2) (* 3 (* a c)))

prune724.0ms

Pruning

11 alts after pruning (9 fresh and 2 done)

Merged error: 11.4b

localize37.0ms

Local error

Found 4 expressions with local error:

25.7b
(sqrt (- (* b b) (* (* (cbrt (* (* 3 a) c)) (cbrt (* (* 3 a) c))) (cbrt (* (* 3 a) c)))))
13.1b
(cbrt (* (* 3 a) c))
13.1b
(cbrt (* (* 3 a) c))
13.1b
(cbrt (* (* 3 a) c))

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 41
Calls

4 calls. Slowest were:

4.0ms
(sqrt (- (* b b) (* (* (cbrt (* (* 3 a) c)) (cbrt (* (* 3 a) c))) (cbrt (* (* 3 a) c)))))
3.0ms
(cbrt (* (* 3 a) c))
3.0ms
(cbrt (* (* 3 a) c))

series499.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

136.0ms
(sqrt (- (* b b) (* (* (cbrt (* (* 3 a) c)) (cbrt (* (* 3 a) c))) (cbrt (* (* 3 a) c)))))
131.0ms
(cbrt (* (* 3 a) c))
123.0ms
(cbrt (* (* 3 a) c))
110.0ms
(cbrt (* (* 3 a) c))

simplify1.9s

Counts
21 → 53
Calls

21 calls. Slowest were:

327.0ms
(sqrt (- (pow (* b b) 3) (pow (* (* (cbrt (* (* 3 a) c)) (cbrt (* (* 3 a) c))) (cbrt (* (* 3 a) c))) 3)))
228.0ms
(sqrt (- (* (* b b) (* b b)) (* (* (* (cbrt (* (* 3 a) c)) (cbrt (* (* 3 a) c))) (cbrt (* (* 3 a) c))) (* (* (cbrt (* (* 3 a) c)) (cbrt (* (* 3 a) c))) (cbrt (* (* 3 a) c))))))
178.0ms
(* (exp (* -1/3 (+ (log (/ 1 a)) (log (/ 1 c))))) (cbrt 3))

prune793.0ms

Pruning

11 alts after pruning (8 fresh and 3 done)

Merged error: 11.4b

regimes564.0ms

Accuracy

83.3% (3.6b remaining)

Error of 15.7b against oracle of 12.0b and baseline of 33.7b

bsearch295.0ms

end0.0ms

sample4.3s

Algorithm
intervals