Average Error: 34.1 → 10.3
Time: 16.8s
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 -4.0614473548971374 \cdot 10^{+148}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 1.2612246360442721 \cdot 10^{-22}:\\ \;\;\;\;\frac{\sqrt{{b_2}^{2} - c \cdot a} - 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 < -4.0614473548971374e+148

    1. Initial program 58.9

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}{a}\]
    4. Taylor expanded around -inf 2.2

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

    if -4.0614473548971374e+148 < b_2 < 1.2612246360442721e-22

    1. Initial program 14.7

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

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

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

    if 1.2612246360442721e-22 < b_2

    1. Initial program 54.5

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}{a}\]
    4. Taylor expanded around inf 6.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.0614473548971374 \cdot 10^{+148}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 1.2612246360442721 \cdot 10^{-22}:\\ \;\;\;\;\frac{\sqrt{{b_2}^{2} - c \cdot a} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019007 
(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.6s)Debug log

sample152.0ms

Algorithm
intervals

simplify54.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune13.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 33.9b

localize18.0ms

Local error

Found 4 expressions with local error:

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

rewrite82.0ms

Algorithm
rewrite-expression-head
Counts
4 → 53
Calls

4 calls. Slowest were:

40.0ms
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
20.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
4.0ms
(- (* b_2 b_2) (* a c))

series207.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

74.0ms
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
57.0ms
(sqrt (- (* b_2 b_2) (* a c)))
42.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
34.0ms
(- (* b_2 b_2) (* a c))

simplify1.2s

Counts
24 → 65
Calls

24 calls. Slowest were:

232.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
231.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
222.0ms
(- (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (* b_2 b_2))

prune628.0ms

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 6.1b

localize13.0ms

Local error

Found 4 expressions with local error:

23.9b
(sqrt (- (pow b_2 2) (* a c)))
1.5b
(- (sqrt (- (pow b_2 2) (* a c))) b_2)
1.0b
(- (pow b_2 2) (* a c))
0.1b
(/ (- (sqrt (- (pow b_2 2) (* a c))) b_2) a)

rewrite80.0ms

Algorithm
rewrite-expression-head
Counts
4 → 53
Calls

4 calls. Slowest were:

57.0ms
(/ (- (sqrt (- (pow b_2 2) (* a c))) b_2) a)
14.0ms
(- (sqrt (- (pow b_2 2) (* a c))) b_2)
4.0ms
(- (pow b_2 2) (* a c))

series185.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

61.0ms
(/ (- (sqrt (- (pow b_2 2) (* a c))) b_2) a)
58.0ms
(- (sqrt (- (pow b_2 2) (* a c))) b_2)
38.0ms
(sqrt (- (pow b_2 2) (* a c)))
27.0ms
(- (pow b_2 2) (* a c))

simplify1.5s

Counts
24 → 65
Calls

24 calls. Slowest were:

384.0ms
(- (* (sqrt (- (pow b_2 2) (* a c))) (sqrt (- (pow b_2 2) (* a c)))) (* b_2 b_2))
341.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))
287.0ms
(sqrt (- (* (pow b_2 2) (pow b_2 2)) (* (* a c) (* a c))))

prune683.0ms

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 6.1b

localize13.0ms

Local error

Found 4 expressions with local error:

23.9b
(sqrt (- (* b_2 b_2) (* a c)))
1.5b
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
1.0b
(- (* b_2 b_2) (* a c))
0.1b
(/ 1 (/ a (- (sqrt (- (* b_2 b_2) (* a c))) b_2)))

rewrite34.0ms

Algorithm
rewrite-expression-head
Counts
4 → 57
Calls

4 calls. Slowest were:

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

series248.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

87.0ms
(/ 1 (/ a (- (sqrt (- (* b_2 b_2) (* a c))) b_2)))
66.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
60.0ms
(sqrt (- (* b_2 b_2) (* a c)))
35.0ms
(- (* b_2 b_2) (* a c))

simplify1.2s

Counts
27 → 69
Calls

27 calls. Slowest were:

310.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
281.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
149.0ms
(+ (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (+ (* b_2 b_2) (* (sqrt (- (* b_2 b_2) (* a c))) b_2)))

prune751.0ms

Pruning

11 alts after pruning (9 fresh and 2 done)

Merged error: 6.1b

localize11.0ms

Local error

Found 4 expressions with local error:

23.9b
(sqrt (- (* b_2 b_2) (* a c)))
1.5b
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
1.0b
(- (* b_2 b_2) (* a c))
0.2b
(* (/ 1 a) (- (sqrt (- (* b_2 b_2) (* a c))) b_2))

rewrite66.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

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

series186.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

79.0ms
(* (/ 1 a) (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
42.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
35.0ms
(sqrt (- (* b_2 b_2) (* a c)))
30.0ms
(- (* b_2 b_2) (* a c))

simplify3.1s

Counts
38 → 76
Calls

38 calls. Slowest were:

576.0ms
(* (* (* (/ 1 a) (/ 1 a)) (/ 1 a)) (* (* (- (sqrt (- (* b_2 b_2) (* a c))) b_2) (- (sqrt (- (* b_2 b_2) (* a c))) b_2)) (- (sqrt (- (* b_2 b_2) (* a c))) b_2)))
444.0ms
(* a (+ (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (+ (* b_2 b_2) (* (sqrt (- (* b_2 b_2) (* a c))) b_2))))
382.0ms
(* 1 (- (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (* b_2 b_2)))

prune753.0ms

Pruning

11 alts after pruning (8 fresh and 3 done)

Merged error: 6.1b

regimes394.0ms

Accuracy

83.3% (4.8b remaining)

Error of 10.3b against oracle of 5.5b and baseline of 34.1b

bsearch204.0ms

end0.0ms

sample3.7s

Algorithm
intervals