Average Error: 33.4 → 10.7
Time: 25.5s
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}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \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{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

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. Using strategy rm
    4. Applied div-sub45.4

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

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

      \[\leadsto \color{blue}{(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*}\]

    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}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \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{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019008 +o rules:numerics
(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: 24.2s)Debug log

sample194.0ms

Algorithm
intervals

simplify45.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

45.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: 34.5b

localize19.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)

rewrite70.0ms

Algorithm
rewrite-expression-head
Counts
4 → 69
Calls

4 calls. Slowest were:

47.0ms
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
13.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series219.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

70.0ms
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
65.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
58.0ms
(sqrt (- (* b_2 b_2) (* a c)))
25.0ms
(- (* b_2 b_2) (* a c))

simplify2.0s

Counts
31 → 81
Calls

31 calls. Slowest were:

491.0ms
(- (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (* b_2 b_2))
432.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
311.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune776.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)

rewrite44.0ms

Algorithm
rewrite-expression-head
Counts
4 → 91
Calls

4 calls. Slowest were:

25.0ms
(- (/ (sqrt (- (* b_2 b_2) (* a c))) a) (/ b_2 a))
10.0ms
(/ (sqrt (- (* b_2 b_2) (* a c))) a)
4.0ms
(- (* b_2 b_2) (* a c))

series223.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

80.0ms
(/ (sqrt (- (* b_2 b_2) (* a c))) a)
60.0ms
(- (/ (sqrt (- (* b_2 b_2) (* a c))) a) (/ b_2 a))
56.0ms
(sqrt (- (* b_2 b_2) (* a c)))
26.0ms
(- (* b_2 b_2) (* a c))

simplify4.0s

Counts
72 → 103
Calls

72 calls. Slowest were:

546.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
511.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
421.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune1.1s

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)))
1.0b
(- (* b_2 b_2) (* a c))

rewrite22.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

6.0ms
(sqrt (- (* b_2 b_2) (* a c)))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series172.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

55.0ms
(sqrt (- (* b_2 b_2) (* a c)))
45.0ms
(sqrt (- (* b_2 b_2) (* a c)))
36.0ms
(- (* b_2 b_2) (* a c))
35.0ms
(sqrt (- (* b_2 b_2) (* a c)))

simplify3.3s

Counts
33 → 76
Calls

33 calls. Slowest were:

556.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
490.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
451.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune972.0ms

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 6.9b

localize27.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))

rewrite35.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

25.0ms
(- (/ (sqrt (- (* b_2 b_2) (* a c))) a) (/ b_2 a))
3.0ms
(sqrt (- (* b_2 b_2) (* a c)))
3.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series231.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

61.0ms
(sqrt (- (* b_2 b_2) (* a c)))
59.0ms
(sqrt (- (* b_2 b_2) (* a c)))
57.0ms
(sqrt (- (* b_2 b_2) (* a c)))
53.0ms
(- (/ (sqrt (- (* b_2 b_2) (* a c))) a) (/ b_2 a))

simplify4.7s

Counts
74 → 99
Calls

74 calls. Slowest were:

484.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
474.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
394.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune1.3s

Pruning

12 alts after pruning (10 fresh and 2 done)

Merged error: 6.9b

regimes387.0ms

Accuracy

81.8% (5.1b remaining)

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

bsearch239.0ms

end0.0ms

sample4.1s

Algorithm
intervals