Average Error: 33.7 → 9.4
Time: 21.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.4031947752424545 \cdot 10^{+120}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.8264402218067264 \cdot 10^{-70}:\\ \;\;\;\;\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 -2.9566045583213624 \cdot 10^{-91}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.2243609558936807 \cdot 10^{+127}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{b_2}{a}\\ \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.4031947752424545e+120 or -3.8264402218067264e-70 < b_2 < -2.9566045583213624e-91

    1. Initial program 58.3

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

      \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    4. Using strategy rm
    5. Applied div-inv59.2

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

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

    if -1.4031947752424545e+120 < b_2 < -3.8264402218067264e-70

    1. Initial program 42.9

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

      \[\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/45.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. Simplified16.0

      \[\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 -2.9566045583213624e-91 < b_2 < 1.2243609558936807e+127

    1. Initial program 11.8

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

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

    if 1.2243609558936807e+127 < b_2

    1. Initial program 52.5

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

      \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    4. Using strategy rm
    5. Applied clear-num52.5

      \[\leadsto \frac{-b_2}{a} - \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    6. Taylor expanded around 0 2.9

      \[\leadsto \frac{-b_2}{a} - \color{blue}{\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.4031947752424545 \cdot 10^{+120}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.8264402218067264 \cdot 10^{-70}:\\ \;\;\;\;\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 -2.9566045583213624 \cdot 10^{-91}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.2243609558936807 \cdot 10^{+127}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{b_2}{a}\\ \end{array}\]

Reproduce

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

sample866.0ms

Algorithm
intervals

simplify29.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

29.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.8b

localize47.0ms

Local error

Found 4 expressions with local error:

24.0b
(sqrt (- (* b_2 b_2) (* a c)))
1.7b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
1.2b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite30.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

16.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
6.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series173.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

56.0ms
(sqrt (- (* b_2 b_2) (* a c)))
53.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
42.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
21.0ms
(- (* b_2 b_2) (* a c))

simplify1.4s

Counts
32 → 73
Calls

32 calls. Slowest were:

270.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))
224.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
194.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune876.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 6.1b

localize17.0ms

Local error

Found 4 expressions with local error:

24.0b
(sqrt (- (* b_2 b_2) (* a c)))
6.6b
(- (/ (- b_2) a) (/ (sqrt (- (* b_2 b_2) (* a c))) a))
1.2b
(- (* b_2 b_2) (* a c))
0.1b
(/ (sqrt (- (* b_2 b_2) (* a c))) a)

rewrite31.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

16.0ms
(- (/ (- b_2) a) (/ (sqrt (- (* b_2 b_2) (* a c))) a))
6.0ms
(/ (sqrt (- (* b_2 b_2) (* a c))) a)
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series212.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

82.0ms
(- (/ (- b_2) a) (/ (sqrt (- (* b_2 b_2) (* a c))) a))
66.0ms
(/ (sqrt (- (* b_2 b_2) (* a c))) a)
42.0ms
(sqrt (- (* b_2 b_2) (* a c)))
22.0ms
(- (* b_2 b_2) (* a c))

simplify1.7s

Counts
36 → 74
Calls

36 calls. Slowest were:

302.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
268.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))))

prune738.0ms

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 6.1b

localize9.0ms

Local error

Found 4 expressions with local error:

24.0b
(sqrt (- (* b_2 b_2) (* a c)))
10.1b
(- (/ (- b_2) a) (/ 1 (/ a (sqrt (- (* b_2 b_2) (* a c))))))
1.2b
(- (* b_2 b_2) (* a c))
0.2b
(/ 1 (/ a (sqrt (- (* b_2 b_2) (* a c)))))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 63
Calls

4 calls. Slowest were:

5.0ms
(- (/ (- b_2) a) (/ 1 (/ a (sqrt (- (* b_2 b_2) (* a c))))))
2.0ms
(sqrt (- (* b_2 b_2) (* a c)))
2.0ms
(- (* b_2 b_2) (* a c))

series216.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

80.0ms
(- (/ (- b_2) a) (/ 1 (/ a (sqrt (- (* b_2 b_2) (* a c))))))
52.0ms
(/ 1 (/ a (sqrt (- (* b_2 b_2) (* a c)))))
49.0ms
(sqrt (- (* b_2 b_2) (* a c)))
34.0ms
(- (* b_2 b_2) (* a c))

simplify1.5s

Counts
35 → 75
Calls

35 calls. Slowest were:

287.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
257.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
136.0ms
(sqrt (+ (* (* b_2 b_2) (* b_2 b_2)) (+ (* (* a c) (* a c)) (* (* b_2 b_2) (* a c)))))

prune878.0ms

Pruning

12 alts after pruning (10 fresh and 2 done)

Merged error: 6.1b

localize8.0ms

Local error

Found 4 expressions with local error:

24.0b
(sqrt (- (* b_2 b_2) (* a c)))
10.9b
(- (/ (- b_2) a) (* (sqrt (- (* b_2 b_2) (* a c))) (/ 1 a)))
1.2b
(- (* b_2 b_2) (* a c))
0.3b
(* (sqrt (- (* b_2 b_2) (* a c))) (/ 1 a))

rewrite20.0ms

Algorithm
rewrite-expression-head
Counts
4 → 75
Calls

4 calls. Slowest were:

8.0ms
(- (/ (- b_2) a) (* (sqrt (- (* b_2 b_2) (* a c))) (/ 1 a)))
6.0ms
(* (sqrt (- (* b_2 b_2) (* a c))) (/ 1 a))
2.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series230.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

76.0ms
(* (sqrt (- (* b_2 b_2) (* a c))) (/ 1 a))
59.0ms
(sqrt (- (* b_2 b_2) (* a c)))
58.0ms
(- (/ (- b_2) a) (* (sqrt (- (* b_2 b_2) (* a c))) (/ 1 a)))
36.0ms
(- (* b_2 b_2) (* a c))

simplify4.5s

Counts
55 → 87
Calls

55 calls. Slowest were:

702.0ms
(- (* (- b_2) (sqrt (+ (* b_2 b_2) (* a c)))) (* a (* (sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c)))) (/ 1 a))))
433.0ms
(- (* (- b_2) (* (sqrt (+ (* b_2 b_2) (* a c))) a)) (* a (* (sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c)))) 1)))
377.0ms
(* (sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3))) (/ 1 a))

prune1.1s

Pruning

11 alts after pruning (9 fresh and 2 done)

Merged error: 6.1b

regimes467.0ms

Accuracy

86.4% (3.9b remaining)

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

bsearch533.0ms

end0.0ms

sample4.2s

Algorithm
intervals