Average Error: 33.7 → 6.5
Time: 21.7s
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 -8.18380023338469 \cdot 10^{+152}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -4.089318305554672 \cdot 10^{-307}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 3.3987455899985826 \cdot 10^{+126}:\\ \;\;\;\;\frac{(\left(\sqrt[3]{-b_2} \cdot \sqrt[3]{-b_2}\right) \cdot \left(\sqrt[3]{-b_2}\right) + \left(-\sqrt{b_2 \cdot b_2 - c \cdot a}\right))_*}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -8.18380023338469e+152

    1. Initial program 62.8

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

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

    if -8.18380023338469e+152 < b_2 < -4.089318305554672e-307

    1. Initial program 33.8

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

      \[\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/37.7

      \[\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. Simplified19.4

      \[\leadsto \frac{\color{blue}{a \cdot c}}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]
    6. Using strategy rm
    7. Applied times-frac8.4

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\]
    10. Using strategy rm
    11. Applied *-un-lft-identity8.4

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

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

    if -4.089318305554672e-307 < b_2 < 3.3987455899985826e+126

    1. Initial program 8.6

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

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{-b_2} \cdot \sqrt[3]{-b_2}\right) \cdot \sqrt[3]{-b_2}} - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    4. Applied fma-neg9.0

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

    if 3.3987455899985826e+126 < b_2

    1. Initial program 52.4

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

      \[\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/62.2

      \[\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. Simplified62.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -8.18380023338469 \cdot 10^{+152}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -4.089318305554672 \cdot 10^{-307}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 3.3987455899985826 \cdot 10^{+126}:\\ \;\;\;\;\frac{(\left(\sqrt[3]{-b_2} \cdot \sqrt[3]{-b_2}\right) \cdot \left(\sqrt[3]{-b_2}\right) + \left(-\sqrt{b_2 \cdot b_2 - c \cdot a}\right))_*}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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

sample236.0ms

Algorithm
intervals

simplify53.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 33.8b

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

rewrite55.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

35.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
7.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series271.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

87.0ms
(sqrt (- (* b_2 b_2) (* a c)))
80.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
69.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
35.0ms
(- (* b_2 b_2) (* a c))

simplify3.8s

Counts
84 → 111
Calls

84 calls. Slowest were:

568.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
403.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
208.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))

prune1.1s

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)))
16.8b
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
1.5b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
1.2b
(- (* b_2 b_2) (* a c))

rewrite37.0ms

Algorithm
rewrite-expression-head
Counts
4 → 70
Calls

4 calls. Slowest were:

14.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
12.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series272.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

132.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
58.0ms
(sqrt (- (* b_2 b_2) (* a c)))
54.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
28.0ms
(- (* b_2 b_2) (* a c))

simplify2.5s

Counts
32 → 82
Calls

32 calls. Slowest were:

630.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))))))
446.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
420.0ms
(- (log (* a c)) (log (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))

prune868.0ms

Pruning

8 alts after pruning (8 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)))
1.5b
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
1.2b
(- (* b_2 b_2) (* a c))
0.1b
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))

rewrite49.0ms

Algorithm
rewrite-expression-head
Counts
4 → 68
Calls

4 calls. Slowest were:

26.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
11.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series314.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

172.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
68.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
40.0ms
(sqrt (- (* b_2 b_2) (* a c)))
34.0ms
(- (* b_2 b_2) (* a c))

simplify1.5s

Counts
31 → 80
Calls

31 calls. Slowest were:

493.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
343.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
247.0ms
(+ (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (+ (* b_2 b_2) (* (sqrt (- (* b_2 b_2) (* a c))) b_2)))

prune813.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 6.1b

localize20.0ms

Local error

Found 4 expressions with local error:

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

rewrite64.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

26.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
25.0ms
(/ (/ c 1) (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series310.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

146.0ms
(/ (/ c 1) (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
73.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
60.0ms
(sqrt (- (* b_2 b_2) (* a c)))
31.0ms
(- (* b_2 b_2) (* a c))

simplify2.4s

Counts
59 → 99
Calls

59 calls. Slowest were:

496.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
357.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
278.0ms
(+ (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (+ (* b_2 b_2) (* (sqrt (- (* b_2 b_2) (* a c))) b_2)))

prune958.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 6.1b

regimes261.0ms

Accuracy

95.9% (1.0b remaining)

Error of 6.5b against oracle of 5.5b and baseline of 29.8b

bsearch425.0ms

end0.0ms

sample4.5s

Algorithm
intervals