Average Error: 33.5 → 10.6
Time: 38.9s
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 -2.8328889513248502 \cdot 10^{-121}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 3.0964691378674393 \cdot 10^{+108}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \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 < -2.8328889513248502e-121

    1. Initial program 50.8

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 50.8

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} - a \cdot c}}}{a}\]
    3. Taylor expanded around -inf 11.6

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

    if -2.8328889513248502e-121 < b_2 < 3.0964691378674393e+108

    1. Initial program 11.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity11.9

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{a}\]
    4. Applied associate-/l*12.0

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

    if 3.0964691378674393e+108 < b_2

    1. Initial program 46.3

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around inf 3.5

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

      \[\leadsto \color{blue}{(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.8328889513248502 \cdot 10^{-121}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 3.0964691378674393 \cdot 10^{+108}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \end{array}\]

Reproduce

herbie shell --seed 2018365 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))

Details

Time bar (total: 32.1s)Debug log

start509.0ms

Algorithm
intervals

setup74.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 34.5b

localize424.0ms

Local error

Found 4 expressions with local error:

24.1b
(sqrt (- (* b_2 b_2) (* a c)))
1.3b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.8b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite40.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

18.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
9.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
8.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series202.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

72.0ms
(sqrt (- (* b_2 b_2) (* a c)))
59.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
45.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
25.0ms
(- (* b_2 b_2) (* a c))

simplify3.8s

Counts
84 → 111
Calls

84 calls. Slowest were:

403.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
322.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
294.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))

prune1.4s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 5.9b

localize17.0ms

Local error

Found 4 expressions with local error:

24.1b
(sqrt (- (pow b_2 2) (* a c)))
1.3b
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
0.8b
(- (pow b_2 2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)

rewrite57.0ms

Algorithm
rewrite-expression-head
Counts
4 → 105
Calls

4 calls. Slowest were:

22.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
18.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
11.0ms
(sqrt (- (pow b_2 2) (* a c)))

series222.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

71.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
59.0ms
(sqrt (- (pow b_2 2) (* a c)))
57.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
35.0ms
(- (pow b_2 2) (* a c))

simplify3.6s

Counts
92 → 117
Calls

92 calls. Slowest were:

440.0ms
(sqrt (- (* (pow b_2 2) (pow b_2 2)) (* (* a c) (* a c))))
350.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))
207.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (pow b_2 2) (* a c))) (sqrt (- (pow b_2 2) (* a c)))))

prune1.4s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 5.9b

localize6.0ms

Local error

Found 4 expressions with local error:

24.1b
(sqrt (- (* b_2 b_2) (* a c)))
1.3b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.8b
(- (* b_2 b_2) (* a c))
0.2b
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 100
Calls

4 calls. Slowest were:

9.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
3.0ms
(sqrt (- (* b_2 b_2) (* a c)))
2.0ms
(- (* b_2 b_2) (* a c))

series213.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

74.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
56.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
55.0ms
(sqrt (- (* b_2 b_2) (* a c)))
27.0ms
(- (* b_2 b_2) (* a c))

simplify3.6s

Counts
85 → 112
Calls

85 calls. Slowest were:

475.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
394.0ms
(+ (* (- b_2) (- b_2)) (+ (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (* (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
375.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune1.3s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 5.9b

localize17.0ms

Local error

Found 4 expressions with local error:

24.1b
(sqrt (- (* b_2 b_2) (* a c)))
1.3b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.8b
(- (* b_2 b_2) (* a c))
0.3b
(/ (/ 1 a) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))

rewrite36.0ms

Algorithm
rewrite-expression-head
Counts
4 → 129
Calls

4 calls. Slowest were:

15.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
9.0ms
(/ (/ 1 a) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series220.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

71.0ms
(/ (/ 1 a) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
66.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
61.0ms
(sqrt (- (* b_2 b_2) (* a c)))
23.0ms
(- (* b_2 b_2) (* a c))

simplify12.6s

Counts
137 → 141
Calls

137 calls. Slowest were:

1.6s
(/ (* (* (/ 1 a) (/ 1 a)) (/ 1 a)) (* (* (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
724.0ms
(/ (cbrt (/ 1 a)) (+ (* (- b_2) (- b_2)) (+ (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (* (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
720.0ms
(/ (sqrt (/ 1 a)) (+ (* (- b_2) (- b_2)) (+ (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (* (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))

prune1.8s

Pruning

9 alts after pruning (7 fresh and 2 done)

Merged error: 5.9b

regimes423.0ms

Accuracy

82.3% (5.0b remaining)

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

bsearch257.0ms