Average Error: 32.7 → 6.4
Time: 27.5s
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.8211790457242957 \cdot 10^{+131}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.3637169296967385 \cdot 10^{-222}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 1.5697271662513251 \cdot 10^{+75}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{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 4 regimes
  2. if b_2 < -2.8211790457242957e+131

    1. Initial program 60.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification60.9

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied div-inv60.9

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    5. Taylor expanded around -inf 2.0

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

    if -2.8211790457242957e+131 < b_2 < 1.3637169296967385e-222

    1. Initial program 30.4

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification30.4

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

      \[\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}\]
    5. Applied associate-/l/35.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)}}\]
    6. Simplified20.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)}\]
    7. Using strategy rm
    8. Applied times-frac8.8

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

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

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

    if 1.3637169296967385e-222 < b_2 < 1.5697271662513251e+75

    1. Initial program 7.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification7.1

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied div-inv7.3

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    5. Using strategy rm
    6. Applied un-div-inv7.1

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

    if 1.5697271662513251e+75 < b_2

    1. Initial program 40.0

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification40.0

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

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    5. Taylor expanded around inf 5.2

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}}\]
    6. Simplified5.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.8211790457242957 \cdot 10^{+131}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.3637169296967385 \cdot 10^{-222}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 1.5697271662513251 \cdot 10^{+75}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{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 2018362 +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: 21.3s)Debug log

start262.0ms

Algorithm
intervals

setup76.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.7b

localize43.0ms

Local error

Found 4 expressions with local error:

21.0b
(sqrt (- (* b_2 b_2) (* a c)))
0.9b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.4b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite80.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

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

series203.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

63.0ms
(sqrt (- (* b_2 b_2) (* a c)))
56.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
53.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
31.0ms
(- (* b_2 b_2) (* a c))

simplify4.0s

Counts
84 → 111
Calls

84 calls. Slowest were:

499.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
394.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
298.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))

prune1.2s

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 4.1b

localize16.0ms

Local error

Found 4 expressions with local error:

21.0b
(sqrt (- (* b_2 b_2) (* a c)))
13.2b
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
1.8b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.4b
(- (* b_2 b_2) (* a c))

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
4 → 70
Calls

4 calls. Slowest were:

12.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
10.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series268.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

135.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
59.0ms
(sqrt (- (* b_2 b_2) (* a c)))
48.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
26.0ms
(- (* b_2 b_2) (* a c))

simplify2.9s

Counts
32 → 82
Calls

32 calls. Slowest were:

632.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))))))
494.0ms
(- (log (* a c)) (log (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
426.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune916.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 4.1b

localize8.0ms

Local error

Found 4 expressions with local error:

21.0b
(sqrt (- (* b_2 b_2) (* a c)))
1.8b
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
0.4b
(- (* b_2 b_2) (* a c))
0.1b
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
4 → 68
Calls

4 calls. Slowest were:

12.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
11.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
3.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series284.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

151.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
67.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
40.0ms
(sqrt (- (* b_2 b_2) (* a c)))
25.0ms
(- (* b_2 b_2) (* a c))

simplify1.6s

Counts
31 → 80
Calls

31 calls. Slowest were:

501.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)))
199.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)))

prune867.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 4.1b

localize11.0ms

Local error

Found 4 expressions with local error:

21.0b
(sqrt (- (* b_2 b_2) (* a c)))
0.9b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.4b
(- (* b_2 b_2) (* a c))
0.2b
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))

rewrite40.0ms

Algorithm
rewrite-expression-head
Counts
4 → 107
Calls

4 calls. Slowest were:

17.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
13.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series194.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

79.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
43.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
37.0ms
(- (* b_2 b_2) (* a c))
36.0ms
(sqrt (- (* b_2 b_2) (* a c)))

simplify6.1s

Counts
94 → 119
Calls

94 calls. Slowest were:

623.0ms
(* (- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3)) 1)
570.0ms
(* (* (* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))) (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))) (* (* (/ 1 a) (/ 1 a)) (/ 1 a)))
568.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune1.4s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 4.1b

regimes363.0ms

Accuracy

95.2% (1.1b remaining)

Error of 6.4b against oracle of 5.3b and baseline of 28.9b

bsearch402.0ms