Average Error: 33.0 → 8.6
Time: 31.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 -4.5550426908734494 \cdot 10^{+95}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -7.909515526455137 \cdot 10^{-171}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 1.2614257711811345 \cdot 10^{+67}:\\ \;\;\;\;\frac{1}{a} \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right)\\ \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 < -4.5550426908734494e+95

    1. Initial program 58.4

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} - a \cdot c}}}{a}\]
    3. Taylor expanded around -inf 2.6

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

    if -4.5550426908734494e+95 < b_2 < -7.909515526455137e-171

    1. Initial program 37.6

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

      \[\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--37.7

      \[\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/37.7

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

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

    if -7.909515526455137e-171 < b_2 < 1.2614257711811345e+67

    1. Initial program 10.6

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

      \[\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 *-commutative10.7

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

    if 1.2614257711811345e+67 < b_2

    1. Initial program 38.5

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. 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 simplification8.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.5550426908734494 \cdot 10^{+95}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -7.909515526455137 \cdot 10^{-171}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 1.2614257711811345 \cdot 10^{+67}:\\ \;\;\;\;\frac{1}{a} \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \end{array}\]

Reproduce

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

sample163.0ms

Algorithm
intervals
Results
359×(pre true 80)
200×(body real 80)
85×(body nan 80)
34×(body real 2560)
20×(body real 1280)
13×(body real 640)
(body real 5120)
(body real 320)
(body real 160)

simplify46.0ms

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

prune35.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.3b

localize51.0ms

Local error

Found 4 expressions with local error:

22.7b
(sqrt (- (* b_2 b_2) (* a c)))
0.8b
(- (* b_2 b_2) (* a c))
0.5b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite59.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
36.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
13.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(- (* b_2 b_2) (* a c))

series292.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
95.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
79.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
76.0ms
(sqrt (- (* b_2 b_2) (* a c)))
41.0ms
(- (* b_2 b_2) (* a c))

simplify2.3s

Counts
32 → 73
Calls
32 calls:
Slowest
409.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
361.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))
355.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
271.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))
187.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))

prune1.2s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 5.3b

localize40.0ms

Local error

Found 4 expressions with local error:

22.7b
(sqrt (- (pow b_2 2) (* a c)))
0.8b
(- (pow b_2 2) (* a c))
0.5b
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
0.1b
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)

rewrite73.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
42.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
16.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
7.0ms
(- (pow b_2 2) (* a c))
7.0ms
(sqrt (- (pow b_2 2) (* a c)))

series292.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
96.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
78.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
70.0ms
(sqrt (- (pow b_2 2) (* a c)))
47.0ms
(- (pow b_2 2) (* a c))

simplify3.2s

Counts
32 → 73
Calls
32 calls:
Slowest
906.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (pow b_2 2) (* a c))) (sqrt (- (pow b_2 2) (* a c)))))
502.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))
462.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (pow b_2 2) (* a c))) 3))
355.0ms
(sqrt (- (* (pow b_2 2) (pow b_2 2)) (* (* a c) (* a c))))
188.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))

prune1.4s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 5.3b

localize18.0ms

Local error

Found 4 expressions with local error:

22.7b
(sqrt (- (* b_2 b_2) (* a c)))
0.8b
(- (* b_2 b_2) (* a c))
0.5b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.3b
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))

rewrite61.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
32.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
14.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
7.0ms
(- (* b_2 b_2) (* a c))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series321.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
107.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
89.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
79.0ms
(sqrt (- (* b_2 b_2) (* a c)))
45.0ms
(- (* b_2 b_2) (* a c))

simplify4.6s

Counts
42 → 81
Calls
42 calls:
Slowest
623.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)))
475.0ms
(* (- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c))))) 1)
470.0ms
(* (- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3)) 1)
446.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
439.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))

prune1.3s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 5.3b

localize9.0ms

Local error

Found 4 expressions with local error:

22.7b
(sqrt (- (* b_2 b_2) (* a c)))
0.8b
(- (* b_2 b_2) (* a c))
0.5b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.3b
(* (/ 1 a) (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))

rewrite53.0ms

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

series317.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
121.0ms
(* (/ 1 a) (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))
79.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
76.0ms
(sqrt (- (* b_2 b_2) (* a c)))
41.0ms
(- (* b_2 b_2) (* a c))

simplify5.4s

Counts
47 → 84
Calls
47 calls:
Slowest
1.1s
(* (* (* (/ 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))))))
534.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))))))
456.0ms
(* 1 (- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c))))))
408.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
406.0ms
(* 1 (- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3)))

prune1.4s

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 5.3b

regimes444.0ms

Accuracy

88.7% (3.1b remaining)

Error of 8.6b against oracle of 5.5b and baseline of 33.0b

bsearch551.0ms

end0.0ms

sample6.0s

Algorithm
intervals
Results
11655×(pre true 80)
5920×(body real 80)
2914×(body nan 80)
1020×(body real 2560)
879×(body real 1280)
471×(body real 640)
227×(body real 320)
118×(body real 5120)
106×(body real 160)