Average Error: 33.2 → 9.4
Time: 26.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 -1.248052338324558 \cdot 10^{+85}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.2946614796208325 \cdot 10^{-116}:\\ \;\;\;\;\frac{c \cdot a}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - c \cdot a}\right)}\\ \mathbf{elif}\;b_2 \le 3.945589219663718 \cdot 10^{+109}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{{b_2}^{2} - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -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 4 regimes
  2. if b_2 < -1.248052338324558e+85

    1. Initial program 57.6

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

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

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

    if -1.248052338324558e+85 < b_2 < -3.2946614796208325e-116

    1. Initial program 40.3

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--40.4

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

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

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

    if -3.2946614796208325e-116 < b_2 < 3.945589219663718e+109

    1. Initial program 11.7

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

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

    if 3.945589219663718e+109 < b_2

    1. Initial program 46.6

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} - a \cdot c}}}{a}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity46.6

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{{b_2}^{2} - a \cdot c}}}}\]
    6. Taylor expanded around 0 3.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.248052338324558 \cdot 10^{+85}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.2946614796208325 \cdot 10^{-116}:\\ \;\;\;\;\frac{c \cdot a}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - c \cdot a}\right)}\\ \mathbf{elif}\;b_2 \le 3.945589219663718 \cdot 10^{+109}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{{b_2}^{2} - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \end{array}\]

Reproduce

herbie shell --seed 2019008 +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: 25.0s)Debug log

sample226.0ms

Algorithm
intervals

simplify47.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune15.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 34.0b

localize32.0ms

Local error

Found 4 expressions with local error:

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

rewrite65.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

34.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
14.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
8.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series191.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

71.0ms
(sqrt (- (* b_2 b_2) (* a c)))
55.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
44.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
20.0ms
(- (* b_2 b_2) (* a c))

simplify3.6s

Counts
84 → 111
Calls

84 calls. Slowest were:

474.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
336.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
260.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))

prune1.1s

Pruning

13 alts after pruning (13 fresh and 0 done)

Merged error: 6.6b

localize28.0ms

Local error

Found 4 expressions with local error:

23.7b
(sqrt (- (pow b_2 2) (* a c)))
1.0b
(- (pow b_2 2) (* a c))
0.8b
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
0.1b
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)

rewrite60.0ms

Algorithm
rewrite-expression-head
Counts
4 → 105
Calls

4 calls. Slowest were:

28.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
14.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
9.0ms
(sqrt (- (pow b_2 2) (* a c)))

series174.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

52.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
49.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
42.0ms
(sqrt (- (pow b_2 2) (* a c)))
29.0ms
(- (pow b_2 2) (* a c))

simplify3.6s

Counts
92 → 117
Calls

92 calls. Slowest were:

396.0ms
(sqrt (- (* (pow b_2 2) (pow b_2 2)) (* (* a c) (* a c))))
319.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))
187.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (pow b_2 2) (* a c))) (sqrt (- (pow b_2 2) (* a c)))))

prune1.1s

Pruning

13 alts after pruning (12 fresh and 1 done)

Merged error: 6.6b

localize8.0ms

Local error

Found 4 expressions with local error:

23.7b
(sqrt (- (pow b_2 2) (* a c)))
1.0b
(- (pow b_2 2) (* a c))
0.8b
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
0.1b
(/ 1 (/ a (- (- b_2) (sqrt (- (pow b_2 2) (* a c))))))

rewrite31.0ms

Algorithm
rewrite-expression-head
Counts
4 → 106
Calls

4 calls. Slowest were:

17.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
6.0ms
(- (pow b_2 2) (* a c))
4.0ms
(sqrt (- (pow b_2 2) (* a c)))

series191.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

90.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (pow b_2 2) (* a c))))))
41.0ms
(sqrt (- (pow b_2 2) (* a c)))
40.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
20.0ms
(- (pow b_2 2) (* a c))

simplify3.8s

Counts
93 → 118
Calls

93 calls. Slowest were:

395.0ms
(sqrt (- (* (pow b_2 2) (pow b_2 2)) (* (* a c) (* a c))))
350.0ms
(+ (* (- b_2) (- b_2)) (+ (* (sqrt (- (pow b_2 2) (* a c))) (sqrt (- (pow b_2 2) (* a c)))) (* (- b_2) (sqrt (- (pow b_2 2) (* a c))))))
328.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))

prune1.3s

Pruning

13 alts after pruning (11 fresh and 2 done)

Merged error: 6.6b

localize19.0ms

Local error

Found 4 expressions with local error:

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

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

series154.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

53.0ms
(sqrt (- (* b_2 b_2) (* a c)))
48.0ms
(sqrt (- (* b_2 b_2) (* a c)))
34.0ms
(sqrt (- (* b_2 b_2) (* a c)))
20.0ms
(- (* b_2 b_2) (* a c))

simplify3.1s

Counts
33 → 76
Calls

33 calls. Slowest were:

479.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
459.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
384.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune1.1s

Pruning

13 alts after pruning (10 fresh and 3 done)

Merged error: 6.6b

regimes807.0ms

Accuracy

85.9% (3.9b remaining)

Error of 9.4b against oracle of 5.5b and baseline of 33.2b

bsearch407.0ms

end0.0ms

sample3.8s

Algorithm
intervals