Average Error: 33.2 → 9.4
Time: 19.0s
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{\left(-b_2\right) - \color{blue}{1 \cdot \sqrt{{b_2}^{2} - a \cdot c}}}{a}\]
    5. Applied *-un-lft-identity46.6

      \[\leadsto \frac{\color{blue}{1 \cdot \left(-b_2\right)} - 1 \cdot \sqrt{{b_2}^{2} - a \cdot c}}{a}\]
    6. Applied distribute-lft-out--46.6

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{{b_2}^{2} - a \cdot c}}}}\]
    8. 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 
(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: 17.7s)Debug log

sample315.0ms

Algorithm
intervals

simplify120.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune16.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 34.0b

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

rewrite57.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

32.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
12.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
7.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series194.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

66.0ms
(sqrt (- (* b_2 b_2) (* a c)))
57.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
51.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
20.0ms
(- (* b_2 b_2) (* a c))

simplify1.5s

Counts
32 → 73
Calls

32 calls. Slowest were:

256.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
254.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
239.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))

prune897.0ms

Pruning

13 alts after pruning (13 fresh and 0 done)

Merged error: 6.6b

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

rewrite51.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

36.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
7.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
3.0ms
(- (pow b_2 2) (* a c))

series190.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

63.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
52.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
48.0ms
(sqrt (- (pow b_2 2) (* a c)))
27.0ms
(- (pow b_2 2) (* a c))

simplify2.2s

Counts
32 → 73
Calls

32 calls. Slowest were:

671.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (pow b_2 2) (* a c))) (sqrt (- (pow b_2 2) (* a c)))))
424.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))
311.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (pow b_2 2) (* a c))) 3))

prune946.0ms

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 6.6b

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

rewrite27.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

13.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
5.0ms
(- (pow b_2 2) (* a c))
5.0ms
(sqrt (- (pow b_2 2) (* a c)))

series247.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

104.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (pow b_2 2) (* a c))))))
63.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
57.0ms
(sqrt (- (pow b_2 2) (* a c)))
22.0ms
(- (pow b_2 2) (* a c))

simplify1.5s

Counts
33 → 74
Calls

33 calls. Slowest were:

359.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))
324.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))))))
203.0ms
(sqrt (- (* (pow b_2 2) (pow b_2 2)) (* (* a c) (* a c))))

prune919.0ms

Pruning

12 alts after pruning (10 fresh and 2 done)

Merged error: 6.6b

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

rewrite10.0ms

Algorithm
rewrite-expression-head
Counts
4 → 54
Calls

4 calls. Slowest were:

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

series188.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

57.0ms
(sqrt (- (* b_2 b_2) (* a c)))
54.0ms
(sqrt (- (* b_2 b_2) (* a c)))
44.0ms
(sqrt (- (* b_2 b_2) (* a c)))
33.0ms
(- (* b_2 b_2) (* a c))

simplify2.2s

Counts
31 → 66
Calls

31 calls. Slowest were:

297.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
292.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
270.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune981.0ms

Pruning

12 alts after pruning (9 fresh and 3 done)

Merged error: 6.6b

regimes662.0ms

Accuracy

85.9% (3.9b remaining)

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

bsearch385.0ms

end0.0ms

sample3.9s

Algorithm
intervals