Average Error: 32.7 → 6.4
Time: 19.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 -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}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \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 < -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}}\]
  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}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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

start268.0ms

Algorithm
intervals

setup95.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.7b

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

rewrite40.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

23.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
7.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series261.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

77.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
71.0ms
(sqrt (- (* b_2 b_2) (* a c)))
70.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
42.0ms
(- (* b_2 b_2) (* a c))

simplify1.5s

Counts
32 → 73
Calls

32 calls. Slowest were:

265.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
251.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))
171.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))

prune734.0ms

Pruning

7 alts after pruning (7 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)))
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))

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 56
Calls

4 calls. Slowest were:

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

series276.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

134.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
65.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
42.0ms
(sqrt (- (* b_2 b_2) (* a c)))
35.0ms
(- (* b_2 b_2) (* a c))

simplify2.3s

Counts
28 → 68
Calls

28 calls. Slowest were:

476.0ms
(- (log (* a c)) (log (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
353.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
291.0ms
(/ (* (* (* a c) (* a c)) (* a c)) (* (* (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))

prune832.0ms

Pruning

7 alts after pruning (7 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))

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
4 → 52
Calls

4 calls. Slowest were:

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

series247.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

151.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
39.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
37.0ms
(sqrt (- (* b_2 b_2) (* a c)))
20.0ms
(- (* b_2 b_2) (* a c))

simplify1.1s

Counts
24 → 64
Calls

24 calls. Slowest were:

297.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
224.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
142.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)))

prune728.0ms

Pruning

7 alts after pruning (6 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))

rewrite37.0ms

Algorithm
rewrite-expression-head
Counts
4 → 69
Calls

4 calls. Slowest were:

18.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
11.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series189.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

69.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
41.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
40.0ms
(sqrt (- (* b_2 b_2) (* a c)))
39.0ms
(- (* b_2 b_2) (* a c))

simplify3.0s

Counts
42 → 81
Calls

42 calls. Slowest were:

526.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)))
333.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
319.0ms
(* (- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c))))) 1)

prune993.0ms

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 4.1b

regimes418.0ms

Accuracy

95.2% (1.1b remaining)

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

bsearch489.0ms