Average Error: 33.3 → 6.8
Time: 15.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 -1.2011928214601198 \cdot 10^{+124}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -5.7718118619005265 \cdot 10^{-295}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}{c}}\\ \mathbf{elif}\;b_2 \le 1.592220113700558 \cdot 10^{+55}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right) \cdot \frac{1}{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.2011928214601198e+124

    1. Initial program 59.7

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

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

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

    if -1.2011928214601198e+124 < b_2 < -5.7718118619005265e-295

    1. Initial program 33.4

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

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

      \[\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}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}} \cdot \frac{1}{a}\]
    6. Applied associate-*l/33.5

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

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

      \[\leadsto \frac{\color{blue}{c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    9. Using strategy rm
    10. Applied clear-num8.8

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

    if -5.7718118619005265e-295 < b_2 < 1.592220113700558e+55

    1. Initial program 9.5

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

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

    if 1.592220113700558e+55 < b_2

    1. Initial program 36.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.2011928214601198 \cdot 10^{+124}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -5.7718118619005265 \cdot 10^{-295}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}{c}}\\ \mathbf{elif}\;b_2 \le 1.592220113700558 \cdot 10^{+55}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \end{array}\]

Reproduce

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

sample214.0ms

Algorithm
intervals

simplify45.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
44.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

prune40.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 34.1b

localize41.0ms

Local error

Found 4 expressions with local error:

23.4b
(sqrt (- (* b_2 b_2) (* a c)))
0.4b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.2b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite56.0ms

Algorithm
rewrite-expression-head
Rules
15×add-sqr-sqrt
10×*-un-lft-identity
add-log-exp
associate-/l*
add-cube-cbrt
sqrt-prod
difference-of-squares
flip--
add-exp-log
add-cbrt-cube
flip3--
pow1
associate-/l/
distribute-lft-out--
diff-log
sqrt-div
sub-neg
div-inv
div-sub
pow1/2
frac-2neg
clear-num
rem-sqrt-square
neg-sub0
associate--l-
Counts
4 → 61
Calls
4 calls:
Slowest
31.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
12.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
7.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(- (* b_2 b_2) (* a c))

series227.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
78.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
74.0ms
(sqrt (- (* b_2 b_2) (* a c)))
44.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
30.0ms
(- (* b_2 b_2) (* a c))

simplify1.5s

Counts
32 → 73
Calls
32 calls:
Slowest
244.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))
214.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
212.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))
204.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
154.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))

prune819.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 6.2b

localize12.0ms

Local error

Found 4 expressions with local error:

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

rewrite29.0ms

Algorithm
rewrite-expression-head
Rules
16×add-sqr-sqrt
11×*-un-lft-identity
add-log-exp
add-cube-cbrt
add-exp-log
associate-*l*
add-cbrt-cube
pow1
flip--
sqrt-prod
flip3--
difference-of-squares
associate-*r*
distribute-lft-out--
associate-*l/
diff-log
sqrt-div
sub-neg
frac-times
div-inv
cbrt-unprod
*-commutative
un-div-inv
associate-*r/
prod-exp
pow-prod-down
pow1/2
rem-sqrt-square
neg-sub0
associate--l-
Counts
4 → 69
Calls
4 calls:
Slowest
13.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
10.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))
2.0ms
(- (* b_2 b_2) (* a c))

series161.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
49.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
43.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
38.0ms
(sqrt (- (* b_2 b_2) (* a c)))
31.0ms
(- (* b_2 b_2) (* a c))

simplify2.7s

Counts
42 → 81
Calls
42 calls:
Slowest
405.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)))
311.0ms
(* (- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3)) 1)
266.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
265.0ms
(* (- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c))))) 1)
261.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune750.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 6.2b

localize10.0ms

Local error

Found 4 expressions with local error:

23.4b
(sqrt (- (* b_2 b_2) (* a c)))
15.2b
(/ (* a c) a)
1.7b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.2b
(- (* b_2 b_2) (* a c))

rewrite16.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
*-un-lft-identity
add-sqr-sqrt
add-cube-cbrt
add-exp-log
add-cbrt-cube
pow1
sqrt-prod
flip--
sqrt-div
flip3--
associate-/l*
distribute-lft-out
div-inv
flip-+
associate-+l-
diff-log
pow1/2
flip3-+
frac-2neg
sub-neg
sum-log
clear-num
rem-sqrt-square
+-commutative
neg-sub0
Counts
4 → 50
Calls
4 calls:
Slowest
9.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
2.0ms
(/ (* a c) a)
2.0ms
(sqrt (- (* b_2 b_2) (* a c)))
2.0ms
(- (* b_2 b_2) (* a c))

series126.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
52.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
44.0ms
(sqrt (- (* b_2 b_2) (* a c)))
22.0ms
(- (* b_2 b_2) (* a c))
8.0ms
(/ (* a c) a)

simplify836.0ms

Counts
21 → 62
Calls
21 calls:
Slowest
245.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
182.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
111.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))
70.0ms
(* (exp (- b_2)) (exp (sqrt (- (* b_2 b_2) (* a c)))))
66.0ms
(- (* 1/2 (/ (* a c) b_2)) (* 2 b_2))

prune704.0ms

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 6.2b

localize7.0ms

Local error

Found 4 expressions with local error:

23.4b
(sqrt (- (* b_2 b_2) (* a c)))
1.7b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.2b
(- (* b_2 b_2) (* a c))
0.1b
(/ c (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))

rewrite16.0ms

Algorithm
rewrite-expression-head
Rules
10×*-un-lft-identity
add-log-exp
add-sqr-sqrt
add-cube-cbrt
add-exp-log
add-cbrt-cube
associate-/r*
pow1
sqrt-prod
distribute-lft-out
flip--
flip-+
associate-/r/
sqrt-div
flip3--
flip3-+
div-inv
associate-+l-
diff-log
pow1/2
frac-2neg
sub-neg
sum-log
clear-num
rem-sqrt-square
+-commutative
neg-sub0
Counts
4 → 55
Calls
4 calls:
Slowest
6.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(/ c (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))
2.0ms
(- (* b_2 b_2) (* a c))

series251.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
128.0ms
(/ c (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))
55.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
37.0ms
(sqrt (- (* b_2 b_2) (* a c)))
32.0ms
(- (* b_2 b_2) (* a c))

simplify1.1s

Counts
27 → 67
Calls
27 calls:
Slowest
250.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
242.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))))))
191.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
138.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))
54.0ms
(- (* 1/2 (/ (* a c) b_2)) b_2)

prune560.0ms

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 6.2b

regimes289.0ms

Accuracy

94.5% (1.3b remaining)

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

bsearch442.0ms

end0.0ms

sample3.8s

Algorithm
intervals