Average Error: 32.7 → 10.2
Time: 17.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 -4.50441748916982 \cdot 10^{-54}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 5.148536202069843 \cdot 10^{+105}:\\ \;\;\;\;\frac{-c}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{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 3 regimes
  2. if b_2 < -4.50441748916982e-54

    1. Initial program 26.0

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

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

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

    if -4.50441748916982e-54 < b_2 < 5.148536202069843e+105

    1. Initial program 24.7

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified24.7

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Using strategy rm
    4. Applied flip--28.5

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - b_2 \cdot b_2}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}}}{a}\]
    5. Applied associate-/l/33.4

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

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

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

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

    if 5.148536202069843e+105 < b_2

    1. Initial program 58.9

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

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.50441748916982 \cdot 10^{-54}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 5.148536202069843 \cdot 10^{+105}:\\ \;\;\;\;\frac{-c}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019002 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))

Details

Time bar (total: 17.0s)Debug log

sample819.0ms

Algorithm
intervals

simplify46.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

46.0ms
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

prune49.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 37.0b

localize37.0ms

Local error

Found 4 expressions with local error:

23.6b
(sqrt (- (* b_2 b_2) (* a c)))
1.1b
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
0.6b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)

rewrite66.0ms

Algorithm
rewrite-expression-head
Counts
4 → 53
Calls

4 calls. Slowest were:

35.0ms
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
18.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series205.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

78.0ms
(sqrt (- (* b_2 b_2) (* a c)))
59.0ms
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
45.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
22.0ms
(- (* b_2 b_2) (* a c))

simplify1.3s

Counts
24 → 65
Calls

24 calls. Slowest were:

361.0ms
(- (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (* b_2 b_2))
270.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
197.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune657.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 4.5b

localize21.0ms

Local error

Found 4 expressions with local error:

23.6b
(sqrt (- (* b_2 b_2) (* a c)))
14.2b
(/ (- (* a c)) (* a (+ (sqrt (- (* b_2 b_2) (* a c))) b_2)))
1.4b
(+ (sqrt (- (* b_2 b_2) (* a c))) b_2)
0.6b
(- (* b_2 b_2) (* a c))

rewrite41.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

17.0ms
(/ (- (* a c)) (* a (+ (sqrt (- (* b_2 b_2) (* a c))) b_2)))
15.0ms
(+ (sqrt (- (* b_2 b_2) (* a c))) b_2)
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series237.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

103.0ms
(/ (- (* a c)) (* a (+ (sqrt (- (* b_2 b_2) (* a c))) b_2)))
52.0ms
(+ (sqrt (- (* b_2 b_2) (* a c))) b_2)
48.0ms
(sqrt (- (* b_2 b_2) (* a c)))
34.0ms
(- (* b_2 b_2) (* a c))

simplify2.6s

Counts
41 → 77
Calls

41 calls. Slowest were:

560.0ms
(/ (* (* (- (* a c)) (- (* a c))) (- (* a c))) (* (* (* a (+ (sqrt (- (* b_2 b_2) (* a c))) b_2)) (* a (+ (sqrt (- (* b_2 b_2) (* a c))) b_2))) (* a (+ (sqrt (- (* b_2 b_2) (* a c))) b_2))))
358.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
244.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune793.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 4.5b

localize16.0ms

Local error

Found 4 expressions with local error:

23.6b
(sqrt (- (* b_2 b_2) (* a c)))
1.4b
(+ b_2 (sqrt (- (* b_2 b_2) (* a c))))
0.6b
(- (* b_2 b_2) (* a c))
0.0b
(/ c (+ b_2 (sqrt (- (* b_2 b_2) (* a c)))))

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
4 → 51
Calls

4 calls. Slowest were:

4.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(- (* b_2 b_2) (* a c))
3.0ms
(+ b_2 (sqrt (- (* b_2 b_2) (* a c))))

series234.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

114.0ms
(/ c (+ b_2 (sqrt (- (* b_2 b_2) (* a c)))))
55.0ms
(sqrt (- (* b_2 b_2) (* a c)))
43.0ms
(+ b_2 (sqrt (- (* b_2 b_2) (* a c))))
21.0ms
(- (* b_2 b_2) (* a c))

simplify1.0s

Counts
24 → 63
Calls

24 calls. Slowest were:

249.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
185.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
179.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))))))

prune657.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 4.5b

localize11.0ms

Local error

Found 4 expressions with local error:

23.6b
(sqrt (- (* b_2 b_2) (* a c)))
7.6b
(/ (* a c) (+ (sqrt (- (* b_2 b_2) (* a c))) b_2))
6.1b
(* (/ -1 a) (/ (* a c) (+ (sqrt (- (* b_2 b_2) (* a c))) b_2)))
1.4b
(+ (sqrt (- (* b_2 b_2) (* a c))) b_2)

rewrite48.0ms

Algorithm
rewrite-expression-head
Counts
4 → 74
Calls

4 calls. Slowest were:

21.0ms
(* (/ -1 a) (/ (* a c) (+ (sqrt (- (* b_2 b_2) (* a c))) b_2)))
17.0ms
(/ (* a c) (+ (sqrt (- (* b_2 b_2) (* a c))) b_2))
7.0ms
(+ (sqrt (- (* b_2 b_2) (* a c))) b_2)

series356.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

149.0ms
(/ (* a c) (+ (sqrt (- (* b_2 b_2) (* a c))) b_2))
102.0ms
(* (/ -1 a) (/ (* a c) (+ (sqrt (- (* b_2 b_2) (* a c))) b_2)))
69.0ms
(+ (sqrt (- (* b_2 b_2) (* a c))) b_2)
37.0ms
(sqrt (- (* b_2 b_2) (* a c)))

simplify2.8s

Counts
51 → 86
Calls

51 calls. Slowest were:

271.0ms
(+ (log (/ -1 a)) (log (/ (* a c) (+ (sqrt (- (* b_2 b_2) (* a c))) b_2))))
269.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)))
252.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune769.0ms

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 4.5b

regimes292.0ms

Accuracy

80.6% (4.6b remaining)

Error of 10.2b against oracle of 5.6b and baseline of 29.3b

bsearch177.0ms

end0.0ms

sample3.8s

Algorithm
intervals