Average Error: 33.3 → 9.7
Time: 19.9s
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.7715196556134555 \cdot 10^{+46}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.1090157738250754 \cdot 10^{-76}:\\ \;\;\;\;\frac{c \cdot a}{a \cdot \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}\\ \mathbf{elif}\;b_2 \le 5.973421650485517 \cdot 10^{+105}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \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.7715196556134555e+46

    1. Initial program 56.2

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

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

    if -1.7715196556134555e+46 < b_2 < -1.1090157738250754e-76

    1. Initial program 42.3

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity42.3

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    5. Using strategy rm
    6. Applied associate-/r/42.3

      \[\leadsto \color{blue}{\frac{1}{a} \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]
    7. Using strategy rm
    8. Applied flip--42.4

      \[\leadsto \frac{1}{a} \cdot \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}}}\]
    9. Applied frac-times45.1

      \[\leadsto \color{blue}{\frac{1 \cdot \left(\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}\right)}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    10. Simplified18.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)}\]
    11. Simplified18.0

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

    if -1.1090157738250754e-76 < b_2 < 5.973421650485517e+105

    1. Initial program 12.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity12.9

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

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

    if 5.973421650485517e+105 < b_2

    1. Initial program 46.4

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

      \[\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 simplification9.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.7715196556134555 \cdot 10^{+46}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.1090157738250754 \cdot 10^{-76}:\\ \;\;\;\;\frac{c \cdot a}{a \cdot \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}\\ \mathbf{elif}\;b_2 \le 5.973421650485517 \cdot 10^{+105}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \end{array}\]

Reproduce

herbie shell --seed 2019002 
(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.0s)Debug log

sample213.0ms

Algorithm
intervals

simplify67.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune8.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 32.3b

localize23.0ms

Local error

Found 4 expressions with local error:

22.2b
(sqrt (- (* b_2 b_2) (* a c)))
1.7b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.6b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

20.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
6.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
3.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series269.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

86.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
84.0ms
(sqrt (- (* b_2 b_2) (* a c)))
63.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
36.0ms
(- (* b_2 b_2) (* a c))

simplify1.6s

Counts
32 → 73
Calls

32 calls. Slowest were:

284.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
247.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))
241.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune871.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 5.0b

localize6.0ms

Local error

Found 4 expressions with local error:

22.2b
(sqrt (- (* b_2 b_2) (* a c)))
1.7b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.6b
(- (* b_2 b_2) (* a c))
0.2b
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

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

series224.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

93.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
51.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
44.0ms
(sqrt (- (* b_2 b_2) (* a c)))
35.0ms
(- (* b_2 b_2) (* a c))

simplify1.5s

Counts
33 → 74
Calls

33 calls. Slowest were:

362.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))))))
303.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
246.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune782.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 5.0b

localize11.0ms

Local error

Found 4 expressions with local error:

22.2b
(sqrt (- (* b_2 b_2) (* a c)))
1.7b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.6b
(- (* b_2 b_2) (* a c))
0.2b
(* (/ 1 a) (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))

rewrite45.0ms

Algorithm
rewrite-expression-head
Counts
4 → 72
Calls

4 calls. Slowest were:

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

series194.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

85.0ms
(* (/ 1 a) (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))
47.0ms
(sqrt (- (* b_2 b_2) (* a c)))
41.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
21.0ms
(- (* b_2 b_2) (* a c))

simplify4.2s

Counts
47 → 84
Calls

47 calls. Slowest were:

975.0ms
(* (* (* (/ 1 a) (/ 1 a)) (/ 1 a)) (* (* (- (- 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))))))
389.0ms
(* 1 (- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c))))))
344.0ms
(* 1 (- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3)))

prune952.0ms

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 5.0b

localize32.0ms

Local error

Found 4 expressions with local error:

22.2b
(sqrt (- (* b_2 b_2) (* c a)))
15.2b
(/ (* a c) (* a (- (sqrt (- (* b_2 b_2) (* c a))) b_2)))
1.1b
(- (sqrt (- (* b_2 b_2) (* c a))) b_2)
0.6b
(- (* b_2 b_2) (* c a))

rewrite37.0ms

Algorithm
rewrite-expression-head
Counts
4 → 54
Calls

4 calls. Slowest were:

15.0ms
(/ (* a c) (* a (- (sqrt (- (* b_2 b_2) (* c a))) b_2)))
10.0ms
(- (sqrt (- (* b_2 b_2) (* c a))) b_2)
9.0ms
(sqrt (- (* b_2 b_2) (* c a)))

series259.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

133.0ms
(/ (* a c) (* a (- (sqrt (- (* b_2 b_2) (* c a))) b_2)))
63.0ms
(- (sqrt (- (* b_2 b_2) (* c a))) b_2)
36.0ms
(sqrt (- (* b_2 b_2) (* c a)))
27.0ms
(- (* b_2 b_2) (* c a))

simplify1.8s

Counts
26 → 66
Calls

26 calls. Slowest were:

567.0ms
(- (log (* a c)) (log (* a (- (sqrt (- (* b_2 b_2) (* c a))) b_2))))
254.0ms
(/ (* (* (* a c) (* a c)) (* a c)) (* (* (* a (- (sqrt (- (* b_2 b_2) (* c a))) b_2)) (* a (- (sqrt (- (* b_2 b_2) (* c a))) b_2))) (* a (- (sqrt (- (* b_2 b_2) (* c a))) b_2))))
230.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* c a) 3)))

prune753.0ms

Pruning

8 alts after pruning (5 fresh and 3 done)

Merged error: 5.0b

regimes320.0ms

Accuracy

85.1% (4.1b remaining)

Error of 9.7b against oracle of 5.6b and baseline of 33.3b

bsearch368.0ms

end0.0ms

sample4.5s

Algorithm
intervals