Average Error: 33.4 → 10.7
Time: 17.2s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -6.341219225938887 \cdot 10^{+106}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 3.716361878826334 \cdot 10^{-131}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a} - \frac{b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if b_2 < -6.341219225938887e+106

    1. Initial program 45.4

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified45.4

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Taylor expanded around -inf 3.1

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

    if -6.341219225938887e+106 < b_2 < 3.716361878826334e-131

    1. Initial program 11.6

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified11.6

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Using strategy rm
    4. Applied div-sub11.6

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a} - \frac{b_2}{a}}\]

    if 3.716361878826334e-131 < b_2

    1. Initial program 49.8

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified49.8

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Using strategy rm
    4. Applied div-sub50.4

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a} - \frac{b_2}{a}}\]
    5. Taylor expanded around inf 12.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -6.341219225938887 \cdot 10^{+106}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 3.716361878826334 \cdot 10^{-131}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a} - \frac{b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019008 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))

Details

Time bar (total: 15.9s)Debug log

sample202.0ms

Algorithm
intervals

simplify47.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

46.0ms
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

prune22.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 34.5b

localize37.0ms

Local error

Found 4 expressions with local error:

23.3b
(sqrt (- (* b_2 b_2) (* a c)))
1.0b
(- (* b_2 b_2) (* a c))
1.0b
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
0.1b
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)

rewrite81.0ms

Algorithm
rewrite-expression-head
Counts
4 → 53
Calls

4 calls. Slowest were:

41.0ms
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
21.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series183.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

72.0ms
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
48.0ms
(sqrt (- (* b_2 b_2) (* a c)))
42.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
20.0ms
(- (* b_2 b_2) (* a c))

simplify1.2s

Counts
24 → 65
Calls

24 calls. Slowest were:

267.0ms
(- (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (* b_2 b_2))
216.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
157.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune703.0ms

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 6.9b

localize8.0ms

Local error

Found 4 expressions with local error:

23.3b
(sqrt (- (* b_2 b_2) (* a c)))
5.6b
(- (/ (sqrt (- (* b_2 b_2) (* a c))) a) (/ b_2 a))
1.0b
(- (* b_2 b_2) (* a c))
0.1b
(/ (sqrt (- (* b_2 b_2) (* a c))) a)

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

12.0ms
(- (/ (sqrt (- (* b_2 b_2) (* a c))) a) (/ b_2 a))
9.0ms
(/ (sqrt (- (* b_2 b_2) (* a c))) a)
3.0ms
(- (* b_2 b_2) (* a c))

series193.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

71.0ms
(/ (sqrt (- (* b_2 b_2) (* a c))) a)
46.0ms
(- (/ (sqrt (- (* b_2 b_2) (* a c))) a) (/ b_2 a))
44.0ms
(sqrt (- (* b_2 b_2) (* a c)))
31.0ms
(- (* b_2 b_2) (* a c))

simplify1.3s

Counts
35 → 73
Calls

35 calls. Slowest were:

260.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
246.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
214.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune627.0ms

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 6.9b

localize26.0ms

Local error

Found 4 expressions with local error:

23.3b
(sqrt (- (* b_2 b_2) (* a c)))
23.3b
(sqrt (- (* b_2 b_2) (* a c)))
23.3b
(sqrt (- (* b_2 b_2) (* a c)))
1.0b
(- (* b_2 b_2) (* a c))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 54
Calls

4 calls. Slowest were:

4.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series152.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

48.0ms
(sqrt (- (* b_2 b_2) (* a c)))
44.0ms
(sqrt (- (* b_2 b_2) (* a c)))
37.0ms
(sqrt (- (* b_2 b_2) (* a c)))
23.0ms
(- (* b_2 b_2) (* a c))

simplify2.2s

Counts
31 → 66
Calls

31 calls. Slowest were:

307.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
304.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
295.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune945.0ms

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 6.9b

localize24.0ms

Local error

Found 4 expressions with local error:

23.3b
(sqrt (- (* b_2 b_2) (* a c)))
23.3b
(sqrt (- (* b_2 b_2) (* a c)))
23.3b
(sqrt (- (* b_2 b_2) (* a c)))
5.6b
(- (/ (sqrt (- (* b_2 b_2) (* a c))) a) (/ b_2 a))

rewrite36.0ms

Algorithm
rewrite-expression-head
Counts
4 → 59
Calls

4 calls. Slowest were:

24.0ms
(- (/ (sqrt (- (* b_2 b_2) (* a c))) a) (/ b_2 a))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series212.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

56.0ms
(sqrt (- (* b_2 b_2) (* a c)))
55.0ms
(sqrt (- (* b_2 b_2) (* a c)))
55.0ms
(- (/ (sqrt (- (* b_2 b_2) (* a c))) a) (/ b_2 a))
45.0ms
(sqrt (- (* b_2 b_2) (* a c)))

simplify2.3s

Counts
39 → 71
Calls

39 calls. Slowest were:

330.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
284.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
269.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune897.0ms

Pruning

11 alts after pruning (9 fresh and 2 done)

Merged error: 6.9b

regimes439.0ms

Accuracy

81.8% (5.1b remaining)

Error of 10.7b against oracle of 5.6b and baseline of 33.6b

bsearch234.0ms

end0.0ms

sample3.8s

Algorithm
intervals